Hello,

        I am not a experienced perl programmer but from the look at your first
post with the perl code. Do you not have to run a close sessions ?

So after your commands:


$ssh = Net::SSH::Perl->new($_, %params);
         $ssh->login("root");
         ($stout,$sterr,$exit) = $ssh->cmd("wget -q $patchurl");

#then add in
close_session($ssh);

Also, if each connection is truly a new connection, should it not be
using a different source port ? If the source port is not changing then
it looks like your code is trying to use the same SSH connection
handle. 

I believe the RFC's make some reference to the tcp port being in a
TIME_WAIT state after a connection closes in case the remote machine
needs to finish up it's end and send a packet or two back.

Michael.


On Wed, 2005-04-06 at 12:52 +0200, gui wrote:
> John Doe wrote:
> > 
> > 
> > I don't see the exact reason. But after having a look in the code (Perl.pm, 
> > sub _create_socket, which tries ports from 1023 down to 512 to bind to), 
> > maybe the ssh object is not destroyed between the loops. You could try:
> > 
> > ** define $ssh as my variable within the loop (not outside as currently)
> > ** put the code within the loop in a separate block, containing the 
> > my-Definition of $ssh
> > ** use "undef $ssh" at the end of the loop (still within it of course)
> > ** Insert some diagnostic code at the beginning of the loop that 
> > a) examines the $ssh object before the second "loop run" and/or 
> > b) sleeps for e.g. a minute, so that you can look whats happening with the 
> > bound port (netstat -neat from cmdline)
> > 
> > I don't have the Modules installed, so I didn't made tests, sorry.
> > 
> > joe
> 
> I tried some of your recommendations, like declaring $ssh in the loop 
> and use "undef $ssh" at the end, but didn't solve the problem.
> I did use netstat -neat during, and after the script launch. I didn't 
> see anything weird during the script running, I did see something 
> bizarre after :
> 
> tcp        0      0 192.168.0.3:1023        192.168.0.1:22 
> TIME_WAIT  0          0
> 
> that line, stayed there for at least a full minute before disappearing. 
> So I decided to add a 2min sleep at the end of the loop... and to my 
> surprise : IT WORKED!
> I used netstat during the 2min sleep, it seems that the connection to 
> the 1023 socket lasts something between 1-2 minutes.
> 
> It's weird, I wish there were another way around it. If anybody got an 
> explanation or a better solution about this "socket bind for more than a 
> minute, than just disappears" enigma, I'd be glad.
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to