| View previous topic :: View next topic |
| Author |
Message |
PspPet
Joined: 30 Mar 2005 Posts: 210
|
Posted: Thu Oct 27, 2005 3:25 am Post subject: 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) |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Thu Oct 27, 2005 10:08 am Post subject: |
|
|
Outstanding! DHCP and the socket timeouts working! Good stuff.
Jim _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Thu Oct 27, 2005 10:30 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
liquid8d
Joined: 30 Jun 2005 Posts: 66
|
Posted: Fri Oct 28, 2005 12:10 am Post subject: |
|
|
Your the man.. thanks PSPPet... this will help a lot! Can't wait to get it implemented.
LiQuiD8d |
|
| Back to top |
|
 |
PspPet
Joined: 30 Mar 2005 Posts: 210
|
Posted: Fri Oct 28, 2005 1:00 am Post subject: |
|
|
> 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) |
|
| Back to top |
|
 |
yktan
Joined: 10 Oct 2005 Posts: 9
|
Posted: Fri Oct 28, 2005 2:20 am Post subject: |
|
|
| Bravo PspPet! |
|
| Back to top |
|
 |
jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Fri Oct 28, 2005 3:22 am Post subject: |
|
|
| 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.
| Quote: | > 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... |
|
| Back to top |
|
 |
Warren
Joined: 24 Jan 2004 Posts: 173 Location: San Diego, CA
|
Posted: Fri Oct 28, 2005 8:14 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
reakt
Joined: 06 May 2005 Posts: 22 Location: Basingstoke, UK
|
Posted: Fri Oct 28, 2005 5:43 pm Post subject: |
|
|
| 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!) |
|
| Back to top |
|
 |
cooleyandy
Joined: 02 Jul 2005 Posts: 41
|
Posted: Sat Oct 29, 2005 3:41 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
ssddn
Joined: 30 Oct 2005 Posts: 2
|
Posted: Sun Oct 30, 2005 6:57 pm Post subject: |
|
|
| Code: | int iNetIndex;
for (iNetIndex = 1; iNetIndex < 100; iNetIndex++) // skip the 0th connection
{
.....
}
|
why skip the 0th connection? |
|
| Back to top |
|
 |
PspPet
Joined: 30 Mar 2005 Posts: 210
|
Posted: Mon Oct 31, 2005 1:15 am Post subject: |
|
|
> 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. |
|
| Back to top |
|
 |
ssddn
Joined: 30 Oct 2005 Posts: 2
|
Posted: Tue Nov 01, 2005 10:53 pm Post subject: |
|
|
| thank you :) |
|
| Back to top |
|
 |
|