-----Original Message-----
From: Thomas Bätzler [mailto:t.baetz...@bringe.com] 
Sent: Wednesday, September 01, 2010 8:57 AM
To: beginners@perl.org
Cc: Kammen van, Marco, Springer SBM NL
Subject: AW: testing tcp connection

>>Kammen van, Marco, Springer SBM NL <marco.vankam...@springer.com> 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

Thanks Thomas, this seems exactly the thing I'm looking for!
I'll give this a go! 

Marco.  



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to