Article View: comp.unix.programmer
Article #321Re: non-blocking accept()
From: Richard M. Rybacki
Date: Thu, 09 Apr 1992 18:01
Date: Thu, 09 Apr 1992 18:01
32 lines
1262 bytes
1262 bytes
In article <1992Apr9.164413.17641@helios.physics.utoronto.ca> amid@bullet.ecf (AMID Rudy) writes: >'lo, > > Can someone suggest to me exactly how to mark accept() non-blocking? If >I RTFM correctly, I have to set the file descriptor somehow. I'm a novice >Unix and C programmer so any help in this section is greatly appreciated. >This is, btw, a socket programming project that I have to do in University. > #include <fcntl.h> #include <errno.h> . . . fcntl(the_sock, F_SETFL, fcntl(the_sock, F_GETFL, 0) | O_NDELAY); . . . if ((new = accept(the_sock,...)) < 0) if (errno == EWOULDBLOCK) /* no queued connection attempts */ else /* Not good if we are here */ -- Richard M. Rybacki | Happiness = Reality - Expectations rrybacki@ringer.cs.utsa.edu | -- Click & Clack, The Tappet Brothers
Technical Details
Message-ID:
<1992Apr9.180132.22714@ringer.cs.utsa.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!ringer!rrybackiReferences:
<1992Apr9.164413.17641@helios.physics.utoronto.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!ringer!rrybacki From: rrybacki@ringer.cs.utsa.edu (Richard M. Rybacki) Newsgroups: comp.unix.programmer Subject: Re: non-blocking accept() Message-ID: <1992Apr9.180132.22714@ringer.cs.utsa.edu> Date: 9 Apr 92 18:01:32 GMT References: <1992Apr9.164413.17641@helios.physics.utoronto.ca> Organization: University of Texas at San Antonio Lines: 32