Mail Archives: djgpp/2000/10/03/07:01:17
Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk> schrieb...
> Hello.
>
> Peter Remmers wrote:
> > What exactly is the difference between the two?
> > The libsocket documentation talks about "similar":
>
> They can both be used to set non-blocking mode, as you know. However,
> fcntl()'s F_SETFL will set multiple options simultaneously. You should do
> something like:
>
> int opts;
>
> opts = fcntl(sock, F_GETFL);
> opts |= O_NONBLOCK;
> if (fcntl(sock, F_SETFL, opts) < 0) {
> /* error */
> }
got it.
> In the libsocket the fcntl() support actually goes through the ioctl()
> code. fcntl(..., O_NONBLOCK) traverses the same code path as ioctl(...,
> FIONBIO, ...). So they have the same effect.
hmm, okay. In your particular implementation of the BSD sockets API
it's the same. But what about real unixes?
> Would things be clearer if the libsocket docs used 'like' instead of
> 'similar'? How do you think the docs could be improved?
That would help a lot. Actually, what you just wrote would make it
very clear :-)
Peter
- Raw text -