Problem to make a stable Wifi client on the PSP

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
AudioMonster
Posts: 37
Joined: Wed Sep 07, 2005 3:41 am
Contact:

Problem to make a stable Wifi client on the PSP

Post by AudioMonster »

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 ?
reakt
Posts: 22
Joined: Fri May 06, 2005 8:35 pm
Location: Basingstoke, UK

Post by reakt »

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
F9zDark
Posts: 127
Joined: Sat Apr 02, 2005 11:34 am

Post by F9zDark »

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...)
AudioMonster
Posts: 37
Joined: Wed Sep 07, 2005 3:41 am
Contact:

Post by AudioMonster »

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 ?
F9zDark
Posts: 127
Joined: Sat Apr 02, 2005 11:34 am

Post by F9zDark »

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.
AudioMonster
Posts: 37
Joined: Wed Sep 07, 2005 3:41 am
Contact:

Post by AudioMonster »

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 :(
PspPet
Posts: 210
Joined: Wed Mar 30, 2005 2:13 am
Contact:

Post by PspPet »

> maybe my wifi router is also the cause of this ?...
> Yesterday i tried to use a non-blocking socket to send data to my server...
If you can, try a different WiFi card (either direct to the PC, or a different WiFi access point/router)
AudioMonster
Posts: 37
Joined: Wed Sep 07, 2005 3:41 am
Contact:

Post by AudioMonster »

OK i'll try that ( My PC is a laptop with integreated WiFi. ).

I'll try using an other router and plug the PC directly on it via RJ45.

But don't you think i should find a solution to make it work with my current setup ?
F9zDark
Posts: 127
Joined: Sat Apr 02, 2005 11:34 am

Post by F9zDark »

Turn off WLAN Power Save. I don't know exactly how its supposed to work, but it doesn't work as one would hope. It drops connection constantly. Try it with Power Save off and see what happens.
AudioMonster
Posts: 37
Joined: Wed Sep 07, 2005 3:41 am
Contact:

Post by AudioMonster »

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 :(
Post Reply