ssh2_connect. How to specify the timeout

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pgb205
Forum Newbie
Posts: 1
Joined: Mon Nov 03, 2008 3:12 pm

ssh2_connect. How to specify the timeout

Post by pgb205 »

I have multiple machines on which I want to execute a particular command. Some of those machines are possibly not
on the network. When I do sshconnection=ssh2_connect(suername,password,port) it works quickly for the machines
that are on the network but drags on forever when it hits a machine that is down. Is there a way to specify a timeout
for ssh2_connect (or for any php command, I guess) so that the script moves on instead of waiting.

thanks bunch in advance for all the replies.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Re: ssh2_connect. How to specify the timeout

Post by infolock »

Look into using rsync command, might help you out.
eugenevdm
Forum Newbie
Posts: 1
Joined: Tue Apr 19, 2011 4:17 am

Re: ssh2_connect. How to specify the timeout

Post by eugenevdm »

I also want to know how to specify the timeout for ssh2_connect. I did some manual tests and it appears to be one minute. This is very long and I would like to shorten it considerably.
Post Reply