Article View: comp.unix.programmer
Article #11Re: Problem making accept() non-blocking (never sees connections)
From: Kartik Subbarao
Date: Wed, 28 Oct 1992 15:12
Date: Wed, 28 Oct 1992 15:12
18 lines
1548 bytes
1548 bytes
In article <1992Oct27.191608.11099@Trirex.COM> bmehlman@trirex.com writes: >My experience is: When the FNDELAY flag on the socket is not >set, the connections are established w/ no problem, but >accept() will block waiting for connections (as expected). > >If FNDELAY is set, then accept will always return >EWOULDBLOCK, even when there are pending connects. FNDELAY works fine for me. The problem I think you're having here is that you're not checking for connect()s enough. If you request non-blocking I/O, it is your responsibility to poll the socket ever so often with an accept() (or you can get fancy and use select()) to check for incoming requests. As far as I can see, you only check *once* for an incoming connect() after you establish the socket. But just how often and where to check for incoming requests depends entirely on the specifics of your program. Perhaps you could elaborate further. -Kartik
Technical Details
Message-ID:
<1992Oct28.151238.15318@Princeton.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!linac!att!princeton!tex.Princeton.EDU!subbaraoReferences:
<1992Oct27.191608.11099@Trirex.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!linac!att!princeton!tex.Princeton.EDU!subbarao
From: subbarao@fc.hp.com (Kartik Subbarao)
Newsgroups: comp.unix.programmer
Subject: Re: Problem making accept() non-blocking (never sees connections)
Message-ID: <1992Oct28.151238.15318@Princeton.EDU>
Date: 28 Oct 92 15:12:38 GMT
Article-I.D.: Princeto.1992Oct28.151238.15318
References: <1992Oct27.191608.11099@Trirex.COM>
Sender: news@Princeton.EDU (USENET News System)
Reply-To: subbarao@fc.hp.com
Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');
Lines: 18
Nntp-Posting-Host: tex.princeton.edu