[Ssh-sftp-perl-users] How to detect a "closed" connection ?
Brought to you by:
dbrobins
From: hugues <Hug...@af...> - 2006-10-04 13:28:52
|
Hi, I'm using Net::SSH::Perl, and i'm having trouble finding the right way to test if a connection (i.e, a Net::SSH::Perl object) is still 'connected'. I'm working on an application than handles delivery to remote sites with "long-life connection handles" through which it send data when there is. The application keeps the connection objects open and sends data when available. The problem is that the remote server may close its end of the connection, and i need a way to detect that so i can re-establish connection when that happens. What i'm actually trying to do if the following: - try the operation (e.g 'put file') when i must - if the operation fails, then check connection state, and reconnect if the check tells me that the connection is closed/broken. I first thought i could use the Net::SSH::Perl::sock(), but that does not seems to work, as it still returns me a valid socket object even when the connection has been broken. I tried to invoke the fileno() method on the returned socket, but that also works (returns me a valid file number instead of 'undef'). Any help would be greatly appreciated. PS: I can provide more details if needed. -- Hugues Lafarge || Email: Hug...@af... Agence France Presse || Phone: +33 1 40 41 77 15 4 rue de la bourse, 75002 Paris || Fax: +33 1 40 41 79 24 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This e-mail, and any file transmitted with it, is confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email. For more information on Agence France-Presse, please visit our web site at http://www.afp.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |