NetBSD-Users archive

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

Re: Non-blocking socket bug



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.

>
> On Linux:
> $ ./a.out
> Create server thread
> Create client thread
> Accept connection, fd=5, addr=127.0.0.1, port=47746
> Connected socket is blocking
>
> On NetBSD:
> $ ./a.out
> Create server thread
> Create client thread
> Accept connection, fd=5, addr=127.0.0.1, port=65534
> Connected socket is non-blocking
>
> Any ideas or comments?
>
> Thanks. 


Home | Main Index | Thread Index | Old Index