in reply to Net::SSH::Perl and simaltaneous connections

I am not quite sure why it would work with one session at a time but fail for multiple ones.

Is it possible that your server detects too many sessions from one ip and terminates the connection?

could you please update the node with your Parallel::ForkManager code and I can run a quick check on my server?

cheers

SK

  • Comment on Re: Net::SSH::Perl and simaltaneous connections

Replies are listed 'Best First'.
Re^2: Net::SSH::Perl and simaltaneous connections
by anthski (Scribe) on Aug 25, 2005 at 03:56 UTC
    Is it possible that your server detects too many sessions from one ip and terminates the connection?

    The problem is that the sessions are being made to different ip's in a concurrent fashion. So it's not just a (well not obviously at least) case of the destination server not allowing multiple simaltanoeus connections to it.

    I can quite happily make as many active and non-active connections to the same ip without drama, by both hand and through the script.

    could you please update the node with your Parallel::ForkManager code and I can run a quick check on my server?

    A cutdown, very simple version of what I'm doing would be as follows:

    #!/usr/bin/perl -w use strict; use Parallel::ForkManager; my (@hosts) = ("192.168.0.1","192.168.0.2","192.168.0.3"); my $sshscript = "ssh.pl"; my $maxProbes = 3; # set this to one to do one at a time my $pm = new Parallel::ForkManager($maxProbes); foreach my $hostname (@hosts) { $pm->start and next; my $stdout = `./$sshscript $hostname`; print "$stdout\n"; $pm->finish; } $pm->wait_all_children; print "done\n";

    with the snippet from the original node saved as ssh.pl and adjusted so that it set $host to the value of $ARGV[0]

    Cheers for your time and reply.

    Anth

      I am terribly sorry. I am going to give up on this :(

      I am on Windows XP SP2. I have to use Window$ because I don't have permissions to install modules on my Linux server.

      I just couldn't get Math::GMP to install and so protocol => 1 bombs. So i am using protocol => 2. I played around with the source code on Net::SSH::Perl but couldn't understand why my Linux servers ssh version is a no-compat!

      C:\>perl connect.pl HOME: Reading configuration data c:/.ssh/config HOME: Reading configuration data /etc/ssh_config HOME: Connecting to 192.168.2.1, port 22. HOME: Reading configuration data c:/.ssh/config HOME: Reading configuration data /etc/ssh_config HOME: Connecting to 192.168.2.8, port 22. HOME: Remote protocol version 2.0, remote software version OpenSSH_3.4 +p1 HOME: Remote protocol version 1.99, remote software version OpenSSH_3. +6.1p2 HOME: Net::SSH::Perl Version 1.28, protocol version 2.0. HOME: No compat match: OpenSSH_3.4p1. Can't set socket non-blocking: Bad file descriptor at C:/Perl/site/lib +/Net/SSH/P erl.pm line 214, <GEN0> line 1.
Re^2: Net::SSH::Perl and simaltaneous connections
by Anonymous Monk on Sep 29, 2014 at 20:29 UTC
    I did it, but still get an error: Can't locate Net/SSH2/Perl.pm in @INC (you may need to i rl module) (@INC contains: C:/Strawberry/perl/site/lib C /lib C:/Strawberry/perl/lib .) at C:\\conn.pl line 4. BEGIN failed--compilation aborted at C:\\conn.pl line 4. Could you tel me why?