in reply to Losing Connection
Looking at the question, i would first think that the addition of select() is about the only way to get around this.
But, in thinking, when writting to a closed socket, a PIPE signal will be generated. In the event of a PIPE signal, it can be checked by either installing a handler, or ignoring the signal. Such as :
More Info :Network Programming with Perl (ISBN: 0-201-61571-1)# method one $SIG{PIPE} = sub { $SERVER_DISCONNECT = 1; }; # # when printing to socket, check $SERVER_DISCONNECT # and handle if ($SERVER_DISCONNECT == 1) # method two (Posix systems only) $SIG{PIPE} = 'IGNORE'; use Errno ':POSIX'; # other code here unless (print SOCKET "$data") { if ($! == EPIPE) { # pipe error, attempt reconnection to server } else { # real error } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Losing Connection
by tye (Sage) on Jun 27, 2001 at 00:50 UTC | |
|
Re: Re: Losing Connection
by Anonymous Monk on Jun 26, 2001 at 22:40 UTC |