Bob Showalter wrote:
> I don't think there's any problem with IO::Socket. Even if accept
> returns a socket, you should receive an EOF on that socket when you
> try to read from it, which tells you that the peer has closed the
> connection. I think you just need to check for both situations: an
> error from accept(), and EOF from read().

Another way of looking at it is to suppose that the client connected, sent a
small message, and then disconnected before you called accept(). The kernel
could still maintain this data in its buffers, and you would obviously need
accept to return the socket so you could read the data.

A connect() followed by a close() is just another form of this scenario. You
need to have a client socket in order to detect the peer's closing the
connection.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to