From owner-freebsd-bugs@freebsd.org Thu Dec 8 13:50:05 2016 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FB25C6D3AB for ; Thu, 8 Dec 2016 13:50:05 +0000 (UTC) (envelope-from rb@gid.co.uk) Received: from mx0.gid.co.uk (mx0.gid.co.uk [194.32.164.250]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACDB6127D for ; Thu, 8 Dec 2016 13:50:04 +0000 (UTC) (envelope-from rb@gid.co.uk) Received: from [192.168.0.226] ([80.71.24.25]) by mx0.gid.co.uk (8.14.2/8.14.2) with ESMTP id uB8DbiAW095152; Thu, 8 Dec 2016 13:37:44 GMT (envelope-from rb@gid.co.uk) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Call to accept() does not time out when setting SO_RCVTIMEO on a socket From: Bob Bishop In-Reply-To: <76cee3a4-18d0-1f8c-eda3-e19c496c39b6@intec.ugent.be> Date: Thu, 8 Dec 2016 13:37:44 +0000 Cc: freebsd-bugs@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <22926F6A-7E4A-49D4-BD54-1E81B1002D61@gid.co.uk> References: <76cee3a4-18d0-1f8c-eda3-e19c496c39b6@intec.ugent.be> To: Dimitri Staessens X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2016 13:50:05 -0000 Hi, > On 8 Dec 2016, at 12:41, Dimitri Staessens = 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