Problem to make a stable Wifi client on the PSP
-
- Posts: 37
- Joined: Wed Sep 07, 2005 3:41 am
- Contact:
Problem to make a stable Wifi client on the PSP
I am using the pspnet lib from pspkrazy's ftpd client to make a small wifi client which connects to a small tcp server running on my PC, the server prints out everything it receives.
I am trying to transfer 256k of text as a test.
Sometimes, it works completely, sometimes, the PSP hangs in the middle.
Also, it sometimes happens that the PSP is hanging when i try to connect to the server with:
sceNetInetConnect(sock, &addrListen, sizeof(addrListen));
even if the server perfectly runs ...
Did some of you experience such random problems ?
I was wondering if there was a timeout problem during the transfer ...
Any idea on how to set the timeout for the socket ?
i did not succeed to do it by using ( with 0 for r, w, o )
int sceNetInetSelect(SOCKET s, fd_set *r, fd_set *w, fd_set *o, struct timeval *timeout);
Also, how can i set the socket to be blocking/non-blocking ?
I am trying to transfer 256k of text as a test.
Sometimes, it works completely, sometimes, the PSP hangs in the middle.
Also, it sometimes happens that the PSP is hanging when i try to connect to the server with:
sceNetInetConnect(sock, &addrListen, sizeof(addrListen));
even if the server perfectly runs ...
Did some of you experience such random problems ?
I was wondering if there was a timeout problem during the transfer ...
Any idea on how to set the timeout for the socket ?
i did not succeed to do it by using ( with 0 for r, w, o )
int sceNetInetSelect(SOCKET s, fd_set *r, fd_set *w, fd_set *o, struct timeval *timeout);
Also, how can i set the socket to be blocking/non-blocking ?
Regarding setting the blocking / non-blocking, and connection timeouts. This was asked (and answered) last week. See this thread: http://forums.ps2dev.org/viewtopic.php?t=3360
Also, if it is of any help, I saw an article a while back showing users how to replace the PSP's WiFi antenna with a more efficient one purchased online. The author's tests showed that the PSP's antenna is abhorrently inefficient and suffers from alot of noise.
The upgraded antenna reduced the noise to almost 0 and increased the operating range. Might be something to think about. (if I can find the link I will post it here. the method isn't practical, since it requires taking the PSP apart...)
The upgraded antenna reduced the noise to almost 0 and increased the operating range. Might be something to think about. (if I can find the link I will post it here. the method isn't practical, since it requires taking the PSP apart...)
-
- Posts: 37
- Joined: Wed Sep 07, 2005 3:41 am
- Contact:
Yes i've seen that one, and i would prefer not taking my PSP apart :-P
My biggest problem is the fact that it stops in the middle of the transfert, randomly.
The interesting thing is, if i brutally stop my server when the PSP seems to be freezed, sceNetInetSend(sock,ss,1024,0); unblocks and returns -1... ( which is expected ).
But why is it blocking then ? I would think it's because the server hasn't received all the data sent by the PSP ( or at least the PSP did not receive acknowledgment ) and PSP's send-buffer is already full, so it blocks waiting some acknowledgment ... maybe my wifi router is also the cause of this ?
My biggest problem is the fact that it stops in the middle of the transfert, randomly.
The interesting thing is, if i brutally stop my server when the PSP seems to be freezed, sceNetInetSend(sock,ss,1024,0); unblocks and returns -1... ( which is expected ).
But why is it blocking then ? I would think it's because the server hasn't received all the data sent by the PSP ( or at least the PSP did not receive acknowledgment ) and PSP's send-buffer is already full, so it blocks waiting some acknowledgment ... maybe my wifi router is also the cause of this ?
This may be a stupid question, but did you turn off WiFi Power Save in the system settings?
That is certainly a killer when it comes to using the WiFi(makes it almost unuseable...)
I got sick of using the Wipeout browser, so I really do not know of how it handles itself for extended periods of time without Power Save on.
That is certainly a killer when it comes to using the WiFi(makes it almost unuseable...)
I got sick of using the Wipeout browser, so I really do not know of how it handles itself for extended periods of time without Power Save on.
-
- Posts: 37
- Joined: Wed Sep 07, 2005 3:41 am
- Contact:
In my settings, the WiFi Power Save is on. I am not sure this is really the problem (?)
Yesterday i tried to use a non-blocking socket to send data to my server. There is a point where the sceNetInetSend function returns -1... i can retry and retry .... it always returns -1 ( i send 100 bytes per call ).
So i tried to do a kind of handshaking mecanism, it would probably slow-down the transfer...
So, the PSP sends 4 bytes saying the number of bytes it is going to send, then sends those bytes, then waits for 4 bytes from the server, then continue...
The server gets the 4 bytes, reads that number of bytes and sends back those 4 bytes to the PSP as an ack.
And i still have the same problem ! :( There is a random point where the PSP will block during the transfer.
Because i use only very low level PSP functions, i have no clue how to solve this :(
Yesterday i tried to use a non-blocking socket to send data to my server. There is a point where the sceNetInetSend function returns -1... i can retry and retry .... it always returns -1 ( i send 100 bytes per call ).
So i tried to do a kind of handshaking mecanism, it would probably slow-down the transfer...
So, the PSP sends 4 bytes saying the number of bytes it is going to send, then sends those bytes, then waits for 4 bytes from the server, then continue...
The server gets the 4 bytes, reads that number of bytes and sends back those 4 bytes to the PSP as an ack.
And i still have the same problem ! :( There is a random point where the PSP will block during the transfer.
Because i use only very low level PSP functions, i have no clue how to solve this :(
-
- Posts: 37
- Joined: Wed Sep 07, 2005 3:41 am
- Contact:
-
- Posts: 37
- Joined: Wed Sep 07, 2005 3:41 am
- Contact:
Ok, so i tried various things.
First i now have "Power save for WLAN" set to OFF.
I tried with a different WiFi router, that i've directly plugged to my laptop via RJ45. Also, i have disabled WEP encryption.
And i still had the same problem.
I tried to play with the send buffer size, reducing it and sending less bytes at each call of sceNetInetSend... and it also end-up to hang.
I have the feeling that i tried everything without success :(
First i now have "Power save for WLAN" set to OFF.
I tried with a different WiFi router, that i've directly plugged to my laptop via RJ45. Also, i have disabled WEP encryption.
And i still had the same problem.
I tried to play with the send buffer size, reducing it and sending less bytes at each call of sceNetInetSend... and it also end-up to hang.
I have the feeling that i tried everything without success :(