delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/03/07:01:17

From: "Peter Remmers" <Peter DOT Remmers AT t-online DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: libsocket: difference between O_NONBLOCK and FIONBIO?
Date: Tue, 3 Oct 2000 12:51:36 +0200
Organization: T-Online
Lines: 39
Message-ID: <8rcdno$99s$16$1@news.t-online.com>
References: <8r9ihm$670$16$1 AT news DOT t-online DOT com> <39D8EACB DOT 7D8400C6 AT phekda DOT freeserve DOT co DOT uk>
Mime-Version: 1.0
X-Trace: news.t-online.com 970570296 16 9532 320094726121-0001 001003 10:51:36
X-Complaints-To: abuse AT t-online DOT de
X-Sender: 320094726121-0001 AT t-dialin DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019