forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
PspPet



Joined: 30 Mar 2005
Posts: 210

PostPosted: Thu Oct 27, 2005 3:25 am    Post subject: Updated Wifi sample .03 - DHCP, socket timeout + simple Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Thu Oct 27, 2005 10:08 am    Post subject: Reply with quote

Outstanding! DHCP and the socket timeouts working! Good stuff.
Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Thu Oct 27, 2005 10:30 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
liquid8d



Joined: 30 Jun 2005
Posts: 66

PostPosted: Fri Oct 28, 2005 12:10 am    Post subject: Reply with quote

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

LiQuiD8d
Back to top
View user's profile Send private message AIM Address
PspPet



Joined: 30 Mar 2005
Posts: 210

PostPosted: Fri Oct 28, 2005 1:00 am    Post subject: Reply with quote

> 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
View user's profile Send private message Send e-mail Visit poster's website
yktan



Joined: 10 Oct 2005
Posts: 9

PostPosted: Fri Oct 28, 2005 2:20 am    Post subject: Reply with quote

Bravo PspPet!
Back to top
View user's profile Send private message
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Fri Oct 28, 2005 3:22 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Warren



Joined: 24 Jan 2004
Posts: 173
Location: San Diego, CA

PostPosted: Fri Oct 28, 2005 8:14 am    Post subject: Reply with quote

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
View user's profile Send private message
reakt



Joined: 06 May 2005
Posts: 22
Location: Basingstoke, UK

PostPosted: Fri Oct 28, 2005 5:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
cooleyandy



Joined: 02 Jul 2005
Posts: 41

PostPosted: Sat Oct 29, 2005 3:41 am    Post subject: Reply with quote

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
View user's profile Send private message
ssddn



Joined: 30 Oct 2005
Posts: 2

PostPosted: Sun Oct 30, 2005 6:57 pm    Post subject: Reply with quote

Code:
    int iNetIndex;
    for (iNetIndex = 1; iNetIndex < 100; iNetIndex++) // skip the 0th connection
    {
         .....
    }

why skip the 0th connection?
Back to top
View user's profile Send private message
PspPet



Joined: 30 Mar 2005
Posts: 210

PostPosted: Mon Oct 31, 2005 1:15 am    Post subject: Reply with quote

> 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
View user's profile Send private message Send e-mail Visit poster's website
ssddn



Joined: 30 Oct 2005
Posts: 2

PostPosted: Tue Nov 01, 2005 10:53 pm    Post subject: Reply with quote

thank you :)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group