 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
liquid8d
Joined: 30 Jun 2005 Posts: 66
|
Posted: Tue Sep 13, 2005 1:17 pm Post subject: sceNetInetSetsockopt |
|
|
Hey,
I was hoping maybe someone has worked some more with sockets and got some of the socket options figured out. From what I see in the latest stuff from PSPPet, it looks like he hasn't gotten into the sockopts yet.
Basically, I just need to be able to timeout sceInetConnect. Is this what I need? I could setup a connect thread and a timeout thread, but that seems a bit much.
LiQuiD8d |
|
| Back to top |
|
 |
reakt
Joined: 06 May 2005 Posts: 22 Location: Basingstoke, UK
|
Posted: Tue Sep 13, 2005 6:34 pm Post subject: |
|
|
Take a look in PspPet's wifi sample 002,
nlh.c
there's a function called:
nlhSimpleConnectWithTimeout
Here he sets the socket options, to make a non-blocking socket
sceNetInetSetsockopt(s, SOL_SOCKET, 0x1009, (const char*)&val, sizeof(u32));
If you look at the rest of the function you'll see that the socket is polled for a finite period of time (the timeout).
So this solves your issue.
Personally I would like to request event notification for a socket. Specifically, the event FD_CONNECT is interesting. This would enable an asynchronous connection facility, so no socket polling would be necessary.
Does anyone know how to do this with the PSP socket library? With winsock, WSAAsyncSelect() is used for this. |
|
| Back to top |
|
 |
PspPet
Joined: 30 Mar 2005 Posts: 210
|
Posted: Wed Sep 14, 2005 12:01 am Post subject: |
|
|
> was hoping maybe someone has worked some more with sockets and got some of the socket options figured out.
As mentioned, see the Wifi .02 sample.
In "my_socket.h". | Code: | // NOTE: many do not work as you would expect (ie. setting RCVTIMEO)
// experiment before relying on anything. |
The 'nlhSimpleConnectWithTimeout' is a sleazy workaround since the RCVTIMEO socket option isn't supported.
The Sony socket implementation is non-standard and they appear to have cut corners. Alhough they patterened the interface on Berkeley sockets, don't rely on any specific behavior unless you've tested it yourself.
[ie "beggers can't be choosers" ;=] |
|
| Back to top |
|
 |
liquid8d
Joined: 30 Jun 2005 Posts: 66
|
Posted: Wed Sep 14, 2005 12:16 am Post subject: |
|
|
That works for me, I'll give it a shot tonight. I must have missed that in the .02 version, thanks guys. (i kind of copied and pasted the new stuff into what I had from original wifi src)
That's all I really need at the moment, but looking over some ftp client source, I have seen some of the "fallback" connection things that are used, which I may need to look into later. (again, I am learning the socket stuff as I go)
LiQuiD8d |
|
| Back to top |
|
 |
|
|
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
|