Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Georgia
    Posts
    20
    Rep Power
    0
    I'll take a look at what you've given me- thanks for all your help.

    Bill
  2. #17
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Georgia
    Posts
    20
    Rep Power
    0
    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.

    Any ideas?

    Bill
  4. #18
  5. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,316
    Rep Power
    2223
    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.
  6. #19
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Georgia
    Posts
    20
    Rep Power
    0
    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.

    Bill
  8. #20
  9. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,316
    Rep Power
    2223
    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:
    fcntl(sock,F_SETFL,O_NONBLOCK);

    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.
  10. #21
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Georgia
    Posts
    20
    Rep Power
    0
    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.

    Bill
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo