Thread: udp non-blocking sockets

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    630

    udp non-blocking sockets

    Hello..

    Im working on udp non-blocking socket. I looked around but I couldnt find any good article or example on it.. How do I have to set udp socket to non-blocking?

    Thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Code:
           It is possible to do non-blocking IO on sockets by setting the O_NONBLOCK flag on a
           socket file descriptor using fcntl(2).  Then all operations that would  block  will
           (usually)  return  with EAGAIN (operation should be retried later); connect(2) will
           return EINPROGRESS error.  The user can then wait for various events via poll(2) or
           select(2).
    Well if you're using Linux anyway.

    If you're on fairly broken windows, you'd better say so.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    630
    Im on windows.

  4. #4
    Registered User
    Join Date
    Aug 2002
    Location
    Hermosa Beach, CA
    Posts
    446
    You could try ACE library, which is a portable network library:

    http://www.cs.wustl.edu/~schmidt/ACE.html
    The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pros and Cons of blocking versus non-blocking sockets?
    By abachler in forum Networking/Device Communication
    Replies: 4
    Last Post: 05-08-2008, 06:52 AM
  2. Sockets and UDP problem
    By ally153 in forum C Programming
    Replies: 5
    Last Post: 03-20-2006, 05:19 AM
  3. multiple UDP sockets with select()
    By nkhambal in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-17-2006, 07:36 PM
  4. Problems with UDP sockets
    By majoub in forum Networking/Device Communication
    Replies: 9
    Last Post: 04-30-2005, 12:25 AM
  5. Non blocking sockets
    By osal in forum Networking/Device Communication
    Replies: 3
    Last Post: 07-23-2004, 06:16 PM