July 20th, 2003, 09:06 AM
I'll take a look at what you've given me- thanks for all your help.
July 20th, 2003, 09:46 AM
Man, this was fast- I've already run into a new hangup.
I'm not sure if I should continue in this thread, but it's a select problem, so here goes.
Right now a slightly more updated version of the code you downloaded does a select with timeout on the socket and then does a select on stdin with timeout. When prompted by the user, it connects to a central server to request information. When I just do a recvfrom immediately after sending the request, I receive the information just fine. When I do a select after sending the request, I never get the information. I re-did my select to correct the problems you mentioned in your last post, but select apparently fails to notice incoming data and so I'm befuddled.
July 20th, 2003, 11:56 AM
Which OS are you doing this on now? You started out in Windows using Winsock, but you also tried the select code in UNIX (SunOS, I seem to recall). Are we still in Windows?
If we are still in Windows, then it won't work to do a select on stdin. In UNIX, almost everything is a file, but not in Windows. In Winsock, you cannot use stdin with select, only sockets (I'm pretty sure; I haven't seen anywhere else select is used in Windows). I don't know whether also trying to use select on stdin is causing your problems, but I do know that it will not work.
July 21st, 2003, 08:45 AM
Sorry, I keep forgetting you're not actually in the room looking at what I'm doing ;). The code I'm now trying to get to work is on a Sun box running SunOS 5.8. It's bizarre, if I do a recvfrom when I'm expecting to receive data from the server then I get the data every time. Select would have me believe there is no data. Instead of using select, is there a function equivalent to recvfrom() where I can set a timeout value? That would really be ideal.
July 21st, 2003, 10:17 AM
I'm tapped out for ideas on this. Have you tried non-blocking sockets on SunOS yet? The difference between UNIX sockets and Winsock is that you would call a different function to make the socket non-blocking:
I haven't played with non-blocking sockets myself yet. There's a working example on the site for the book, "The Pocket Guide to TCP/IP Sockets: C Version ". Sample UNIX code is at http://cs.baylor.edu/~donahoo/Pocket.../textcode.html . The pertinent example is UDPEchoServer-SIGIO.c , which is also UDP plus it uses the SIGIO signal (which I also have not played with yet). You will also need a couple support modules, so you might want to download one of the archives (tarred&gzipped or winzipped).
Last edited by dwise1_aol; July 21st, 2003 at 10:19 AM.
July 23rd, 2003, 12:11 PM
I think nonblocking is going to work for me- it is certainly working on the Sun box code, now I just have to port it over to XP.
Thanks, you have no idea how much this has helped.