[Ssh-sftp-perl-users] How to detect a "closed" connection ?
Brought to you by:
dbrobins
From: hugues <Hug...@af...> - 2006-10-09 08:06:49
|
Hi David, I just sent this request to the 'ssh-sftp-perl-users' mailing list four days ago, but did not see it appear, so i'm resending it to you directly with the mailing-list in copy. Please forgive me if that's fealing rude to you. Here is the description of my problem: Using Net::SFTP/Net::SSH::Perl, i'm having trouble finding the right way to test if a connection is still really 'connected'. I'm working on an application than handles delivery to remote sites with "long-life connection handles" through which it send data via the Net::SFTP module. The application keeps the connection handles open and sends data when there is some 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 need to send data - 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. BTW, i'm also interested in a solution to that same problem with Net::SSH2 that i'm also trying to use (but i'm having some other problems with it, that i'll perhaps describe in another message if i cannot solve them by myself). -- 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 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |