KickinAezz
Joined: 03 Jun 2007 Posts: 328
|
Posted: Thu May 15, 2008 7:51 am Post subject: [SOLVED] Socket getting STUCK if data not sent continuously |
|
|
After trying everything possible.. I decided I would post my problem here. Hopefully, I will recieve some help :D
My problem is Socket on PSP seem to act as Blocking or something I donot know... It seems to get "STUCK" if we donot continuosly send data(confirmed) or continuously recieve data from the server (my hypothesis, haven't tested).
-----
OK, To test I use this server http://bansky.net/echotool/ and you'll have to too.
To start
| Code: |
echotool.exe /p tcp /s 1000 |
PLEASE TEST THIS PSP Binary
---------------------------------------
1) It connects to first Access point in the network list.
2) You will see numbers scrolling on screen... This is to show that PSP isn't "stuck".
3) Press and KEEP HOLDING CIRCLE button.
4) Press for once,
SQUARE to connect to 192.168.2.4:1000 or
CROSS to connect to 192.168.2.5:1000
if your PC has someother IP address, please try manually setting the IP address to one of the above to diagnose my problem. Please donot let this stop you from trying....
5) The server program will recieve and keep recieving "[GOTCHA]" and send it back... It works. However,
Onto the Problem:
-----------------
Release the CIRCLE and you get stuck.
Close the TCP Server and psp gets "unstuck".
Why is this happening?
Anyone got any idea why this is happening?
#### Parts of Code#####
| Code: |
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); //0
socksetting=1;
sceNetInetSetsockopt(sock, SOL_SOCKET, SO_NONBLOCK, (int *)&socksetting, sizeof socksetting);
socksetting= 500000; //half sec
sceNetInetSetsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (int*)&socksetting, sizeof socksetting);
sceNetInetSetsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (int*)&socksetting, sizeof socksetting);
socksetting=1;
sceNetInetSetsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (int*)&socksetting, sizeof socksetting);
if(!initSocket(&name, ipaddr, port)) //simple ip,port setup code
{
pspDebugScreenPrintf("address conf problem\n");
close(sock);
return -1;
}
if(connect(sock, (struct sockaddr *) &name, sizeof(name)) < 0)
main()
{
for(;;)
{
numhold=recv(sockfd,&recvbuff,255,0);
if (numhold!=-1 && numhold!=0)
{
pspDebugScreenPrintf("<-(%s)",recvbuff);
}
if (pad.Buttons & PSP_CTRL_CIRCLE)
{
if ((numhold=send(sockfd,"Gotcha!\n",strlen("Gotcha!\n"),MSG_DONTWAIT))==-1)
{
pspDebugScreenPrintf("->ERROR\n");
sceKernelDelayThread(50000);
}
else
{
pspDebugScreenPrintf("->SENT\n");
}
}
sceDisplayWaitVblankStart();
}
|
_________________ Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Last edited by KickinAezz on Fri May 16, 2008 7:21 am; edited 5 times in total |
|