Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jan 2013 09:56:42 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Sockets programming question
Message-ID:  <CAJ-Vmo=rV5%2BzmPAxyLjuK1H_Yxu-cpQ=93rEONfex7ywrEYHEA@mail.gmail.com>
In-Reply-To: <1359481565.93359.160.camel@revolution.hippie.lan>
References:  <1359385907.93359.84.camel@revolution.hippie.lan> <20130128160238.GT2522@kib.kiev.ua> <1359481565.93359.160.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On 29 January 2013 09:46, Ian Lepore <ian@freebsd.org> wrote:

> You can't use EOF on a read() to determine client life when the nature
> of the client/server relationship is that clients are allowed to
> shutdown(fd, SHUT_WR) as soon as they connect because they expect to
> receive but never send any data.
>
> On the other hand, Alfred's suggestion of using poll(2) rather than
> select(2) worked perfectly.  Polling with an events mask of zero results
> in it returning POLLHUP in revents if the client has closed the socket.

Just make sure that's portable.. :-)



adrian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=rV5%2BzmPAxyLjuK1H_Yxu-cpQ=93rEONfex7ywrEYHEA>