From owner-freebsd-hackers Sat Nov 18 4:28:50 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from ns.hitbase.com (ns.hitbase.com [64.65.2.58]) by hub.freebsd.org (Postfix) with ESMTP id A3C8437B479 for ; Sat, 18 Nov 2000 04:28:46 -0800 (PST) Received: from dima (ppp-237.pool-113.spbnit.ru [212.48.192.237]) by ns.hitbase.com (8.9.3/8.9.3) with SMTP id IAA11152 for ; Sat, 18 Nov 2000 08:25:16 -0500 Message-ID: <002301c05153$0e84e620$edc030d4@dima> From: "Dmitry Sychov" To: Subject: close(), shutdown() behaviour when SO_LINGER is set. Date: Sat, 18 Nov 2000 14:27:44 +0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0012_01C0516B.B70543E0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C0516B.B70543E0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Greetings! I'am developing the single thread http server which uses kqueue/kevent for both sockets and async file reads. It works just fine and I thought I 'd be able to do all the stuff with one thread until it comes to proper socket closing. As far as I understand the only way for server, working with HTTP/1.0 client, to mark the data end is to close the connection when the response was done. According to the interface this does't mean that all the packets will arrive to the client so one should set the socket option to SO_LINGER and then call close() to be sure that all the packets are acknowledged before closing the connection and make the OS handle the connection = close. The problem is, according to some posts, many systems block the process on close() or shutdown() _when_ SO_LINGER is used. My question is: Does it safe to SO_LINGER with close() or shutdown() in = FreeBSD 4.1+? Will they block or not? Thanks for all replies, Dmitry ------=_NextPart_000_0012_01C0516B.B70543E0 Content-Type: text/html; charset="koi8-r" Content-Transfer-Encoding: quoted-printable
Greetings!
 
I'am developing the single thread = http=20 server
which uses kqueue/kevent for both = sockets
and async file reads. It works = just fine and=20 I thought
I 'd be able to do all the stuff = with one=20 thread until it
comes to proper socket = closing.
 
As far as I understand the only = way for=20 server, working
with HTTP/1.0 client, to mark the = data end is=20 to close the
connection when the response was = done.=20 According to the
interface this does't mean that = all the=20 packets will arrive to the
client so one should set the = socket option to=20 SO_LINGER
and then call close() to = be sure that all the packets are = acknowledged
before=20 closing the connection and make = the OS=20 handle the connection close.
 
The problem is, according to some = posts, many=20 systems
block the process on close() or = shutdown()=20 _when_ SO_LINGER is used.
 
My question is:  Does it = safe to=20 SO_LINGER with close() or shutdown() in FreeBSD 4.1+?
Will they block or = not?
 
Thanks for all = replies,
Dmitry
------=_NextPart_000_0012_01C0516B.B70543E0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message