in reply to Re^2: Detecting Dead Socket Connection
in thread Detecting Dead Socket Connection
I think what you want is to use select to see if there is anything ready to be read before calling eof. Well, I kinda lied. Using select is sorta like drilling a hole in one's head - you can do it, but you probably want another solution.
That's where IO::Select comes in. Same piercing, but much faster (to figure out) and less painful. You can assign a timeout, and then do what you want with the filehandle. As long as the socket remains open and unused, select should timeout, but if the socket is closed, select should return the status change (probably by asking "has_exception", but I haven't tested this).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Detecting Dead Socket Connection
by scmason (Monk) on Mar 18, 2005 at 23:57 UTC | |
by Tanktalus (Canon) on Mar 19, 2005 at 00:26 UTC |