Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Dec 2016 13:37:44 +0000
From:      Bob Bishop <rb@gid.co.uk>
To:        Dimitri Staessens <dimitri.staessens@intec.ugent.be>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: Call to accept() does not time out when setting SO_RCVTIMEO on a socket
Message-ID:  <22926F6A-7E4A-49D4-BD54-1E81B1002D61@gid.co.uk>
In-Reply-To: <76cee3a4-18d0-1f8c-eda3-e19c496c39b6@intec.ugent.be>
References:  <76cee3a4-18d0-1f8c-eda3-e19c496c39b6@intec.ugent.be>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

> On 8 Dec 2016, at 12:41, Dimitri Staessens =
<dimitri.staessens@intec.ugent.be> wrote:
>=20
> Dear devs,
>=20
> I'm trying to get an accept() call to time out using setsockopt.
>=20
> On Linux, the example below terminates:
>=20
> [dstaesse@phoneutria]$ gcc accept_st.c -o accept_st
> [dstaesse@phoneutria]$ ./accept_st
> Timeout is 0:100000.
> Check is 0:103333.
> Accept returned: Resource temporarily unavailable.
> Accept returned: Resource temporarily unavailable.
> Accept returned: Resource temporarily unavailable.
> Bye.
>=20
> On FreeBSD 11.0-RELEASE however, it hangs on the accept() forever.


accept() doesn=E2=80=99t work like that on *BSD. Set the socket =
non-blocking and then accept() returns EWOULDBLOCK if there is nothing =
to accept.

> Is this a known issue?
>=20
> Thanks for your help,
>=20
> Dimitri
>=20
> --- example source:
> [snip]
> --=20
> Dimitri Staessens
> Ghent University - imec
> Dept. of Information Technology (INTEC)
> Internet Based Communication Networks and Services
> Technologiepark 15
> 9052 Zwijnaarde
> T: +32 9 331 48 70
> F: +32 9 331 48 99

--
Bob Bishop
rb@gid.co.uk







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?22926F6A-7E4A-49D4-BD54-1E81B1002D61>