Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How to find out whether socket is still connected?

by kabeldag (Hermit)
on Aug 10, 2006 at 13:34 UTC ( [id://566618]=note: print w/replies, xml ) Need Help??


in reply to How to find out whether socket is still connected?



With sockets. You have to actually try to touch the other entity (the other process) be it write or read.
Probably best a write so that you actually ask it to reply. If it doesn't reply then it is not talking correctly.

If you are unable to read within a period of time, then you can base your control flow on that also.

Sockets are the Application layer, which is of course above the transport layer (TCP or UDP or whatever).

You can go an OSI layer lower to the transport layer and work with/look at the packets,
other wise if the socket (IP:port) can not be reached, I don't think you can say it is open for connections.

With the pre-packaged modules for sockets in Perl, you try to read from a handle, if you cannot read from it or write to it, then the other entity/process must not be responding for whatever reason.

Looking at the transport packets to check the state is the way to go.
  • Comment on Re: How to find out whether socket is still connected?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2024-04-19 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found