Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: IO::Socket doesn't detect lost TCP connections

by tjdmlhw (Acolyte)
on Sep 07, 2004 at 19:22 UTC ( [id://389186]=note: print w/replies, xml ) Need Help??


in reply to Re: IO::Socket doesn't detect lost TCP connections
in thread IO::Socket doesn't detect lost TCP connections

The $socket->connected doesn't work for detecting if a socket has been lost. It's explained in another article - $Socket->connected Not Returning False?

Thanks for your reply, I'm still looking so any other ideas are welcome.

Replies are listed 'Best First'.
Re^3: IO::Socket doesn't detect lost TCP connections
by zentara (Archbishop) on Sep 08, 2004 at 13:23 UTC

      No, if you look in the reply to DaveH above, you will see that I tried the sysread, syswrite, can_read, and can_write without success. The syswrite and can_write acted as if the connection was still up. It was on or before the write that I really needed notification of the dropped connection.

      The can_read showed no signs of failure, but the sysread did fail. I have modified my script to use this failure to clear the socket and try to reconnect. This works fine for the current interface, but won't be good enough when I get to a vendor that doesn't send acknowledgements back. I still believe there should be some way of checking the connection without performing a read. I just haven't found it yet.

      That's why I say I'm still looking and would be thankful if anyone knows the answer.

        Let us know what you find. (If you find a way). One thing you may not have investigated, which is still on my list of "unknown territory worthy of investigation); is to look at the filedescriptors associated witht the socket. I wonder if you identified which filedescriptor is handling the socket data, then somehow test it for ( who knows what ?) to see if it's connected?. Maybe the POSIX module may have some clues for you?

        The reason I mention it, is I was experimenting with a server, trying to restart it, without re-execing it, and there was some stale filedescriptors which needed closing manually with POSIX, before I could accept connections. It's pretty complex, with modules involved, but there is some control available to you way down at the "c-code' level. You can see what filedescriptors are open for the socket, with the "socklist" command.

        Just a brainstorm.


        I'm not really a human, but I play one on earth. flash japh

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-03-28 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found