Schrift
[thread]2939[/thread]

Disconnect of Net::SFTP

Leser: 1


<< >> 7 Einträge, 1 Seite
prassito
 2005-05-31 11:42
#29487 #29487
User since
2005-05-31
8 Artikel
BenutzerIn
[default_avatar]
Hi Folks

I have a Perl-Script that tries to connect each minute via SFTP.
But i receive this error every second try, because the socket is still occupied by my connection:

Net::SSH: Can't bind socket to port 1023: Die Adresse wird bereits verwendet at /usr/lib/perl5/site_perl/5.8.5/Net/SFTP.pm line 61

I tried to figure out if there is a methode for a clean shutdown of my SFTP-Object (like $sftp->quit())...or something like this.
But i did find anything yet.

Somebody an idea how to solve this problem?

Thanks and gratz

prassito
renee
 2005-05-31 12:16
#29488 #29488
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
I would use the $sftp-object in a very small scope. If you leave the scope, the object would be destroyed and the connection should be refused.
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
esskar
 2005-05-31 12:53
#29489 #29489
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
or a
Code: (dl )
undef $sftp;
will help
prassito
 2005-05-31 13:58
#29490 #29490
User since
2005-05-31
8 Artikel
BenutzerIn
[default_avatar]
Thanks for the answers

But i am sorry to say, that both advices did not lead to a solution.
Neither undefining nor strictly limiting the existence of the object frees the port. I still get:

Net::SSH: Can't bind socket to port 1023...

Any other hints or solutions?
Thanks anyway.
Gratz

prassito\n\n

<!--EDIT|prassito|1117533540-->
Rambo
 2005-05-31 14:04
#29491 #29491
User since
2003-08-14
803 Artikel
BenutzerIn

user image
are your shure that this port (1023) is not opend by other programs?
normaly sftp used port 22.

regards rambo
esskar
 2005-05-31 14:26
#29492 #29492
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
and, why don't u reuse your object anyway?
prassito
 2005-05-31 14:33
#29493 #29493
User since
2005-05-31
8 Artikel
BenutzerIn
[default_avatar]
Hi Folks

Yes i am sure, that i use this port.
It is defined in:

Net/SSH/Perl.pm

But while looking for this, i found the solution for my task (i know not the best one).
In Line 223 and 224 in the sub _create_socket() you i found this:

my ($p,$end,$delta) = (0,1,1); # normally we use whatever port we can get
($p,$end,$delta) = (1023,512,-1) if $ssh->{config}->get('privileged') ;

I removed the line 224 and now my Script uses different ports to connect.
Anyway thanks for the help.
Gratz

prassito\n\n

<!--EDIT|prassito|1117535705-->
<< >> 7 Einträge, 1 Seite



View all threads created 2005-05-31 11:42.