in reply to Disconnect client without closing socket?

accept() returns a new socket that is connected with the remote client. You still have your original socket that you were listening on. When you are done with this client, close his socket. The rest of your sockets will remain intact.

--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Replies are listed 'Best First'.
Re: Re: Disconnect client without closing socket?
by Anonymous Monk on Dec 15, 2002 at 21:17 UTC
    How do you close the socket? I'm trying to $client->shutdown(2); but the client is still staying connected.

      According to perldoc IO::Socket, IO::Socket is derived from IO::Handle. IO::Handle provides a close() method.

      --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
        The client isn't recognizing that the connection is closed. If I exit the server script, the client tells me that the connection is lost. How do I give the "Connection is lost." message without exitting the program?