本文整理汇总了PHP中Net_SSH2::isConnected方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_SSH2::isConnected方法的具体用法?PHP Net_SSH2::isConnected怎么用?PHP Net_SSH2::isConnected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_SSH2
的用法示例。
在下文中一共展示了Net_SSH2::isConnected方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isConnected
/**
* @return bool
*/
public function isConnected()
{
return $this->ssh->isConnected();
}
示例2: time
}
//send input file to cr2g server
$sftp->mkdir('/code/spopt-stable/tests/' . $session);
$sftp->put($remoteInputFile, $localInputFile, NET_SFTP_LOCAL_FILE);
$sftp->chmod(0777, $remoteInputFile);
//execute python script in this order to run the Solver:
//1. change to directory where solver script is located
$ssh->write("cd /code/spopt-stable\n");
//2. 'read' command to ensure script is called from the proper directory
$ssh->read('rlgruver@cr2g01:/code/spopt-stable$');
//3. run the solver script with the test from the current session
$ssh->write("python SpOpt.py tests/" . $session . "/input.txt\n");
//start timerin case anything gets stuck, will break within 120 minutes (7200 sec)
$starttime = time();
//ssh will break within 120 minutes (7200 sec) regardless of execution status
while ($ssh->isConnected()) {
$now = time() - $starttime;
if ($now > 7200) {
break;
}
sleep(3);
//retrieve all solutions/discarded from cr2g and store in local
$sftp->get($remoteSolutionsFile, $localSolutionsFile);
$sftp->get($remoteDiscardedFile, $localDiscardedFile);
//function to provide discarded solutions during session
parseDiscarded($session);
//if final output file gets created from the cr2g sever, store it in local and complete
if ($sftp->get($remoteOutputFile, $localOutputFile)) {
$done = "true";
break;
}