Updated Wifi sample .03 - DHCP, socket timeout + simple
Updated Wifi sample .03 - DHCP, socket timeout + simple
Updated Wifi sample .03 - DHCP, socket timeout, etc - and simpler sample too
http://www.aibohack.com/psp/wifitest.htm
http://www.aibohack.com/psp/wifi_03.zip
Includes two sample apps with full source "FANCY" and "SIMPLE"
Both use user thread and will work with DHCP (once again thanks 'benji')
The FANCY sample is very similar to the old release (does mini-Telnetd, PhotoFrame, AIBO and CLIE) with user interface and JPEG decoding.
Some of the lower level hacks have been cleaned up a bit.
---
The SIMPLE sample is a much simpler 'printf' style app (no buttons to press)
It will use the first valid connection, and start the mini-Telnetd server.
It also includes a socket receive timeout ! (setsockopts, but the timeout value can be tricky)
If you want to make a simple socket based app, this is the one to start with.
Hopefully this will be the last release from me in this form (still waiting for the official PSPSDK support for the sceNet libraries)
http://www.aibohack.com/psp/wifitest.htm
http://www.aibohack.com/psp/wifi_03.zip
Includes two sample apps with full source "FANCY" and "SIMPLE"
Both use user thread and will work with DHCP (once again thanks 'benji')
The FANCY sample is very similar to the old release (does mini-Telnetd, PhotoFrame, AIBO and CLIE) with user interface and JPEG decoding.
Some of the lower level hacks have been cleaned up a bit.
---
The SIMPLE sample is a much simpler 'printf' style app (no buttons to press)
It will use the first valid connection, and start the mini-Telnetd server.
It also includes a socket receive timeout ! (setsockopts, but the timeout value can be tricky)
If you want to make a simple socket based app, this is the one to start with.
Hopefully this will be the last release from me in this form (still waiting for the official PSPSDK support for the sceNet libraries)
Thanks for these; I have a grasp of how all this should fit together now.
Unfortunately, I'm not having much success with getting the samples to work. Simple doesn't work because my first connection profile isn't the one I can use right now; perhaps an interactive selector wouldn't be out of order?
I'm having more success with Fancy. Firstly, I had to increase the detail[] buffer to 512 because I have a long ESSID in one of my profile settings. Once that's fixed, I can associate with the AP and get to the main menu, but at that point things don't work too well.
If I enable the telnet daemon, it sits there and listens, and I can connect to it (including getting the "type all you want" message, but there's an unbounded delay before anything I type actually appears, and eventually all output stops altogether. It looks like the PSP isn't responding to ARP requests, so once my laptop's ARP cache times out, it doesn't send any more packets. But even if I set a static ARP entry, the PSP just doesn't respond to packets sent to it.
There's no chance this is a connectivity problem; the AP is right next to the PSP on my desk, and the connection strength seems fine.
I tried playing with the priority parameters on sceNetInit(), and got no improvement.
Also, now that things are mostly in user space, can the home button callback be enabled?
Update: it works fine with my home AP. Hm.
Unfortunately, I'm not having much success with getting the samples to work. Simple doesn't work because my first connection profile isn't the one I can use right now; perhaps an interactive selector wouldn't be out of order?
I'm having more success with Fancy. Firstly, I had to increase the detail[] buffer to 512 because I have a long ESSID in one of my profile settings. Once that's fixed, I can associate with the AP and get to the main menu, but at that point things don't work too well.
If I enable the telnet daemon, it sits there and listens, and I can connect to it (including getting the "type all you want" message, but there's an unbounded delay before anything I type actually appears, and eventually all output stops altogether. It looks like the PSP isn't responding to ARP requests, so once my laptop's ARP cache times out, it doesn't send any more packets. But even if I set a static ARP entry, the PSP just doesn't respond to packets sent to it.
There's no chance this is a connectivity problem; the AP is right next to the PSP on my desk, and the connection strength seems fine.
I tried playing with the priority parameters on sceNetInit(), and got no improvement.
Also, now that things are mostly in user space, can the home button callback be enabled?
Update: it works fine with my home AP. Hm.
> Simple doesn't work because my first connection profile isn't the one I can use right now; perhaps an interactive selector wouldn't be out of order?
That's up to you to add - or hard code the index. It is meant as a "printf" compatible example. If you want all the features, go for the "FANCY" version (which lets you pick the connection, and test)
> had to increase the detail[] buffer to 512 because I have a long ESSID
How long ? (I thought it couldn't be longer than 32 or 64 bytes)
> there's an unbounded delay before anything I type actually appears
That delay can vary (part of the TCP/IP stack I assume). If you drop the connection, it should display everything immediately.
>, and eventually all output stops (... it works fine with my home AP.)
That's not good. Some people have reported connection drops, potentially because of the WiFi access point. Try to "ping" the PSP from your PC when things stop. Firewalls may get in the way. Also try the "Simple" version (or move over the timeout code). It will print a "[I'm waiting]" nag message after 15 seconds of inactivity.
> can the home button callback be enabled?
Yes, that's up to you -- but the cleanup code done in a callback can be messy (eg: move all open sockets to globals, notify hosts, close connections, shutdown libraries etc) and redundant with very similar cleanup code you need in the main thread.
Assuming your app has a real user interface (and handles buttons) IMHO you would be better off handling the HOME button yourself in the main user thread and gracefully exit when the user presses HOME (with appropriate user prompts)
That's up to you to add - or hard code the index. It is meant as a "printf" compatible example. If you want all the features, go for the "FANCY" version (which lets you pick the connection, and test)
> had to increase the detail[] buffer to 512 because I have a long ESSID
How long ? (I thought it couldn't be longer than 32 or 64 bytes)
> there's an unbounded delay before anything I type actually appears
That delay can vary (part of the TCP/IP stack I assume). If you drop the connection, it should display everything immediately.
>, and eventually all output stops (... it works fine with my home AP.)
That's not good. Some people have reported connection drops, potentially because of the WiFi access point. Try to "ping" the PSP from your PC when things stop. Firewalls may get in the way. Also try the "Simple" version (or move over the timeout code). It will print a "[I'm waiting]" nag message after 15 seconds of inactivity.
> can the home button callback be enabled?
Yes, that's up to you -- but the cleanup code done in a callback can be messy (eg: move all open sockets to globals, notify hosts, close connections, shutdown libraries etc) and redundant with very similar cleanup code you need in the main thread.
Assuming your app has a real user interface (and handles buttons) IMHO you would be better off handling the HOME button yourself in the main user thread and gracefully exit when the user presses HOME (with appropriate user prompts)
I think the limit is 32, but this entry was right on the limit. I didn't investigate closely, but there was certainly a buffer overrun there.PspPet wrote:> had to increase the detail[] buffer to 512 because I have a long ESSID
How long ? (I thought it couldn't be longer than 32 or 64 bytes)
Packet traffic seems to completely stop; the PSP doesn't even respond when I drop the connection, and the Linux box keeps retransmitting the final packets. It seems there's just a total communications breakdown. I'll stick some more instrumentation in there.> there's an unbounded delay before anything I type actually appears
That delay can vary (part of the TCP/IP stack I assume). If you drop the connection, it should display everything immediately.
>, and eventually all output stops (... it works fine with my home AP.)
That's not good. Some people have reported connection drops, potentially because of the WiFi access point. Try to "ping" the PSP from your PC when things stop. Firewalls may get in the way. Also try the "Simple" version (or move over the timeout code). It will print a "[I'm waiting]" nag message after 15 seconds of inactivity.
The setup is very simple: just an AP, a laptop and the PSP. No routers, firewalls or anything else...
I've got network stuff almost ready to be comitted into the SDK. I'm just testing some of the socket stuff and writing a basic sample to go with it, I'm thinking maybe an internet time example.
I have some generalized fixup code as well as some partially complete code for using the Sony Network Config Dialog to commit also. I should have it wrapped up tomorrow.
I have some generalized fixup code as well as some partially complete code for using the Sony Network Config Dialog to commit also. I should have it wrapped up tomorrow.
-
- Posts: 41
- Joined: Sat Jul 02, 2005 10:12 am
Code: Select all
int iNetIndex;
for (iNetIndex = 1; iNetIndex < 100; iNetIndex++) // skip the 0th connection
{
.....
}