NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Non-blocking socket bug



On Sat, Oct 26, 2019 at 09:42:47PM +0100, Sad Clouds wrote:
> On Sat, 26 Oct 2019 15:20:42 -0500
> Edgar Pettijohn <edgar%pettijohn-web.com@localhost> wrote:
> 
> > 
> > On Oct 26, 2019 2:44 PM, Sad Clouds <cryintothebluesky%gmail.com@localhost>
> > wrote:
> > >
> > > I've come across an issue when testing networking code, which looks
> > > like a bug. This is on NetBSD-8.1
> > >
> > > When a listening socket is set non-blocking and we call accept() on
> > > that socket, the new socket returned by accept() will also be
> > > non-blocking.
> > >
> > > I think this is a bug. I thought all new sockets/file descriptors
> > > would be non-blocking by default. I've attached a test program to
> > > demonstrate the issue.
> > 
> > That is how the manual describes it to be.
> 
> Can you be more specific please, which manual and which case does it
> describe, accept() returning blocking or non-blocking socket?
> 
> I'm not sure at this stage if this is a bug or BSD specific feature.

http://man.openbsd.org/NetBSD-8.1/accept

The accept() argument extracts the first connection request on the queue of pending connections, creates a new socket with the same properties of s and allocates a new file descriptor for the socket.

Same properties being the key concept here I believe.

Edgar


Home | Main Index | Thread Index | Old Index