in reply to Re: Disconnect client without closing socket?
in thread Disconnect client without closing socket?

How do you close the socket? I'm trying to $client->shutdown(2); but the client is still staying connected.
  • Comment on Re: Re: Disconnect client without closing socket?

Replies are listed 'Best First'.
Re: Re: Re: Disconnect client without closing socket?
by pfaut (Priest) on Dec 15, 2002 at 21:20 UTC

    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?

        After forking, you have to close the client handle in the parent. You also need to close the listen socket in the child (unless you've set that handle to close on fork - I forget the system call that does this).

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