in reply to fcntl on Windows
Update:#include <stdio.h> #include <fcntl.h> void SetNonBlocking( int filehandle ) { int fhFlags; fhFlags = fcntl(filehandle,F_GETFL); if (fhFlags < 0) { perror("fcntl(F_GETFL)"); exit(1); } fhFlags |= O_NONBLOCK; if (fcntl(filehandle,F_SETFL,fhFlags) < 0) { perror("fcntl(F_SETFL)"); exit(1); } return; }
My new recomendation is to use select to poll the socket, and when it has data, then read from it blocking. You can simulate non-blocking by using a small timeout on the select and only reading a few charaters (or even just 1) at a time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: fcntl on Windows
by Daimun (Novice) on Mar 21, 2001 at 00:57 UTC | |
by Adam (Vicar) on Mar 21, 2001 at 00:59 UTC | |
by Daimun (Novice) on Mar 21, 2001 at 01:16 UTC | |
by Adam (Vicar) on Mar 21, 2001 at 01:23 UTC | |
by Daimun (Novice) on Mar 21, 2001 at 01:11 UTC |