Kammen van, Marco, Springer SBM NL <[email protected]> asked:
> I have an issue when something goes wrong with the client that's trying
> to connect.
>
> 9 out of 10 times this works fine, but there are odd situations where
> $clientip doesn't get filled in, which leaves me with a connection I
> can't do anything with...
>
> I tried to use close($client) to just terminate these odd connections
> when $clientip is empty but that doesn't work..
>From my understanding of sockets (strictly limited ;-)) you'll need to call
>$client->shutdown( $how ):
>From perlfunc:
shutdown SOCKET,HOW
Shuts down a socket connection in the manner indicated by HOW, which has the
same interpretation as in the system call of the same name.
shutdown(SOCKET, 0); # I/we have stopped reading data
shutdown(SOCKET, 1); # I/we have stopped writing data
shutdown(SOCKET, 2); # I/we have stopped using this socket
This is useful with sockets when you want to tell the other side you're done
writing but not done reading, or vice versa. It's also a more insistent form
of close because it also disables the file descriptor in any forked copies in
other processes.
HTH,
Thomas
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/