sub sub1 { my @InboundParameters = @_; my $num = $InboundParameters[0]; print "started thread $num : Establishing connection with $InboundParameters[1]\n"; my $host = $InboundParameters[2]; my $sftp = Net::SFTP->new($host, user => $InboundParameters[3], password => $InboundParameters[4], debug => 1) or return ( { 'errors' => "Unable to connect to $host: " . $@, 'success' => 0 } ); #$sftp->put("bar", "2345SD/baz"); $sftp->do_mkdir("ftp2SAT5") or "Cannot make directory: $@" . $sftp->error; print "done with thread $num\n"; return $num; } #### Login completed, opening dummy shell channel. channel 0: new [client-session] Requesting channel_open for channel 0. channel 0: open confirm rwindow 0 rmax 32768 channel 1: new [client-session] Requesting channel_open for channel 1. Sending subsystem: sftp Requesting service subsystem on channel 1. channel 1: open confirm rwindow 0 rmax 32768 sftp: Sending SSH2_FXP_INIT sftp: Remote version: 3 sftp: Sent message T:14 I:0 channel 1: rcvd eof channel 1: output open -> drain channel 1: obuf empty channel 1: output drain -> closed channel 1: close_write channel 1: rcvd close channel 1: input open -> closed channel 1: close_read channel 1: send close channel 1: full closed thread failed to start: Connection closed at ./ftp2sats_v0.1.pl line 81 Bus error (core dumped)