Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: How can I test TCP socket status in Perl?

by tangent (Parson)
on Jul 26, 2015 at 23:56 UTC ( [id://1136383]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How can I test TCP socket status in Perl?
in thread How can I test TCP socket status in Perl?

If $sock is not defined you are not connected, so you should test for that as well:
sub AmStillConnected { return unless defined $sock; return unless $sock->connected; return 1; }

Replies are listed 'Best First'.
Re^4: How can I test TCP socket status in Perl?
by beanscake (Acolyte) on Jul 27, 2015 at 00:07 UTC
    thank you this worked work me.
      This may 'work' but be aware that your call to connected() isn't really achieving anything. You should be testing the success or failure of each individual read/write to the socket anyway.

      If you have found all ready the solution to your question, please post the complete code. So other people will benefit in future.

      Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1136383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2024-03-29 15:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found