Thanks for all the help. The "poll" did not work. The frustrating th +ing is that I can get certain things to work (the connection is there +, but the stuff I want to work times out). All I'm trying to do is g +et/put a file on a server. You may be right that it has something to + do with their server (but why would the sftp work described below?). + Anyway, this is what I have. You will notice that the last call (s +ftp) works ok, but the first two (get, channel) do not. ******** CODE **************** use Net::SSH2; use Net::SSH2::Channel; use IO::Scalar; use strict; my $handle = IO::Scalar->new;; my $ssh2 = &connect('ftp.xxxx.com','XXX','PASSWORD'); sub connect { my $host = $_[0]; my $user = $_[1]; my $pw = $_[2]; my $ssh2 = Net::SSH2->new(); $ssh2->connect($host); if ($ssh2->auth_password($user, $pw)) { print "\nIN SFTP\n"; $ssh2->poll(0); $ssh2->scp_get('./test/out/aFile.txt', $handle); print "Error: ", $ssh2->error(), "\n"; $handle->seek(0, 0); _read($handle); print "Reading channel\n"; my $chan = $ssh2->channel; $chan->exec('cat ./test/out/aFile.txt') or die "NO Way +\n"; print "Error: ", $chan->error(), "\n"; _read($chan); print "Reading channel\n"; # (b) read a line at a time with SFTP my $sftp = $ssh2->sftp; my $file = $sftp->open('./test/out/aFile.txt') or die +"No Way Again\n"; print "Error: ", $sftp->error(), "\n"; _read($file); } $ssh2->disconnect(); return $ssh2; } sub _read { my $handle = shift; while (my $line = <$handle>) { print "Getting a line\n"; print $line; } } ****************** RESULTS ***************** IN SFTP Error: -28LIBSSH2_ERROR_SCP_PROTOCOLTimed out waiting for SCP response Reading channel Error: -28LIBSSH2_ERROR_SCP_PROTOCOLTimed out waiting for SCP response Reading channel Error: 0SSH_FX_OK Getting a line aaaaaaaaaaaaaaaaaaaaaaaaa (THIS IS THE CORRECT DATA IN THE FILE) THANKS

In reply to Re^4: Net::ssh2 timeout by llass61
in thread Net::ssh2 timeout by llass61

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.