ps2ip connect to PC problem
Posted: Sat Sep 03, 2005 8:14 pm
Hi guys,
I'm having trouble trying to write code to get my PS2 to connect to a PC using ps2ip.
I am using the latest ps2sdk.
I reset the iop and load the modules as follows:
Everything seems to be fine here, all modules load OK. Next I try to connect to the PC using the following code:
According to the debug, the call to socket succeeds, whereas the call to connect fails. I can connect to
the port using telnet on ps2linux, so it shouldn't be a problem with the network etc.
Can anyone see anything obviously wrong with this code?
Does anyone know of any projects that use ps2ip to connect to servers on remote machines? Everything
I look at sets up a server on the ps2 and connects to it from the PC.
Also, does anyone know if gethostbyname works? This seems to be defined in the irx, but not in the
ps2ip ee code.
Thanks for any tips you can give.
// TJ
I'm having trouble trying to write code to get my PS2 to connect to a PC using ps2ip.
I am using the latest ps2sdk.
I reset the iop and load the modules as follows:
Code: Select all
SifExitRpc();
SifIopReset("rom0:UDNL rom0:EELOADCNF", 0);
while(!SifIopSync());
SifInitRpc(0);
if(SifLoadFileInit() != 0)
return; // bind failed.
log(LOG_SYSTEM, LOG_INFO, "Loading LIBSD module");
if (SifLoadModule("rom0:LIBSD", 0, NULL) < 0)
{
log(LOG_SYSTEM, LOG_ERROR, "Failed to load LIBSD module");
}
log(LOG_SYSTEM, LOG_INFO, "Loading AUDSRV module");
if(SifExecModuleBuffer(audsrv_irx, size_audsrv_irx, 0, NULL, &i) < 0)
{
log(LOG_SYSTEM, LOG_ERROR, "Failed to load AUDSRV module");
}
log(LOG_SYSTEM, LOG_INFO, "Loading PS2IP module");
if(SifExecModuleBuffer(ps2ip_irx, size_ps2ip_irx, 0, NULL, &i) < 0)
{
log(LOG_SYSTEM, LOG_ERROR, "Failed to load PS2IP module");
}
log(LOG_SYSTEM, LOG_INFO, "Loading PS2IPS module");
if(SifExecModuleBuffer(ps2ips_irx, size_ps2ips_irx, 0, NULL, &i) < 0)
{
log(LOG_SYSTEM, LOG_ERROR, "Failed to load PS2IPs module");
}
log(LOG_SYSTEM, LOG_DEBUG, "Initialising ps2ip");
ps2ip_init();
Code: Select all
struct sockaddr_in server;
s32 socket = -1;
s32 retcount = 0;
ip_addr addr;
socket = socket(AF_INET, SOCK_STREAM, 0);
if(socket < 0)
{
log(LOG_DATASOURCE, LOG_ERROR, "HttpDataSource::open failed to create socket");
return false;
}
memset(&server, 0, sizeof(server));
server.sin_family = AF_INET;
IP4_ADDR(&addr, 192, 168, 1, 2);
server.sin_addr.s_addr = addr.addr;
server.sin_port = htons(80);
if(connect(m_socket, (struct sockaddr*)&server, sizeof(server)) < 0)
{
log(LOG_DATASOURCE, LOG_ERROR, "HttpDataSource::open failed to connect");
return false;
}
the port using telnet on ps2linux, so it shouldn't be a problem with the network etc.
Can anyone see anything obviously wrong with this code?
Does anyone know of any projects that use ps2ip to connect to servers on remote machines? Everything
I look at sets up a server on the ps2 and connects to it from the PC.
Also, does anyone know if gethostbyname works? This seems to be defined in the irx, but not in the
ps2ip ee code.
Thanks for any tips you can give.
// TJ