Updated Wifi sample .03 - DHCP, socket timeout + simple

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

Moderators: cheriff, TyRaNiD

Post Reply
PspPet
Posts: 210
Joined: Wed Mar 30, 2005 2:13 am
Contact:

Updated Wifi sample .03 - DHCP, socket timeout + simple

Post by PspPet »

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)
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Outstanding! DHCP and the socket timeouts working! Good stuff.
Jim
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Post by jsgf »

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.
liquid8d
Posts: 66
Joined: Thu Jun 30, 2005 6:29 am

Post by liquid8d »

Your the man.. thanks PSPPet... this will help a lot! Can't wait to get it implemented.

LiQuiD8d
PspPet
Posts: 210
Joined: Wed Mar 30, 2005 2:13 am
Contact:

Post by PspPet »

> 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)
yktan
Posts: 9
Joined: Mon Oct 10, 2005 11:48 pm

Post by yktan »

Bravo PspPet!
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Post by jsgf »

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)
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.
> 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.
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.

The setup is very simple: just an AP, a laptop and the PSP. No routers, firewalls or anything else...
Warren
Posts: 175
Joined: Sat Jan 24, 2004 8:26 am
Location: San Diego, CA

Post by Warren »

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

Post by reakt »

Great job psppet! This will make it much easier for others like myself to make use of the socket library. I'm also looking forward to seeing this integrated into the SDK (Sounds good Warren!)
cooleyandy
Posts: 41
Joined: Sat Jul 02, 2005 10:12 am

Post by cooleyandy »

Wow, I didn't check the forums for a while and then I find the socket library almost implemented :-) It's an exciting time to develop for the psp.
ssddn
Posts: 2
Joined: Sun Oct 30, 2005 6:46 pm

Post by ssddn »

Code: Select all

    int iNetIndex;
    for &#40;iNetIndex = 1; iNetIndex < 100; iNetIndex++&#41; // skip the 0th connection
    &#123;
         .....
    &#125;
why skip the 0th connection?
PspPet
Posts: 210
Joined: Wed Mar 30, 2005 2:13 am
Contact:

Post by PspPet »

> why skip the 0th connection?
Index of zero appears to be temporary settings [I thought it was the last connection used, but it has been unreliable]
All the real connections (as setup in "Infrastructure" mode in settings) start from index 1. You won't miss anything.
ssddn
Posts: 2
Joined: Sun Oct 30, 2005 6:46 pm

Post by ssddn »

thank you :)
Post Reply