本文整理汇总了PHP中SimpleSocket::isOpen方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSocket::isOpen方法的具体用法?PHP SimpleSocket::isOpen怎么用?PHP SimpleSocket::isOpen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSocket
的用法示例。
在下文中一共展示了SimpleSocket::isOpen方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSocketClosure
public function testSocketClosure()
{
$socket = new SimpleSocket('www.lastcraft.com', 80, 15, 8);
$this->assertTrue($socket->isOpen());
$this->assertTrue($socket->write("GET /test/network_confirm.php HTTP/1.0\r\n"));
$socket->write("Host: www.lastcraft.com\r\n");
$socket->write("Connection: close\r\n\r\n");
$this->assertEqual($socket->read(), "HTTP/1.1");
$socket->close();
$this->assertIdentical($socket->read(), false);
}
示例2: testSocketClosure
public function testSocketClosure()
{
$socket = new SimpleSocket($this->host, $this->port, 15, 8);
$this->assertTrue($socket->isOpen());
$this->assertTrue($socket->write("GET /network_confirm.php HTTP/1.0\r\n"));
$socket->write("Host: {$this->host}\r\n");
$socket->write("Connection: close\r\n\r\n");
$this->assertEqual($socket->read(), 'HTTP/1.0');
$socket->close();
$this->assertIdentical($socket->read(), false);
}
示例3: testSocket
function testSocket()
{
$socket = new SimpleSocket("www.lastcraft.com", 80);
$this->assertFalse($socket->isError(), "Error [" . $socket->getError() . "]");
$this->assertTrue($socket->isOpen());
$this->assertTrue($socket->write("GET www.lastcraft.com/test/network_confirm.php HTTP/1.0\r\n"));
$socket->write("Host: localhost\r\n");
$socket->write("Connection: close\r\n\r\n");
$this->assertEqual($socket->read(8), "HTTP/1.1");
$socket->close();
$this->assertEqual($socket->read(8), "");
}
示例4: testSocketClosure
function testSocketClosure()
{
$site = $this->getServerInfo();
$socket = new SimpleSocket($site['host'], $site['port'], 15, 8);
$this->assertTrue($socket->isOpen());
$this->assertTrue($socket->write("GET {$site['path']}network_confirm.php HTTP/1.0\r\n"));
$socket->write("Host: {$site['host']}\r\n");
$socket->write("Connection: close\r\n\r\n");
$this->assertEqual($socket->read(), "HTTP/1.1");
$socket->close();
$this->assertIdentical($socket->read(), false);
}
示例5: skip
function skip()
{
$socket = new SimpleSocket($this->host, $this->port, 5, 8);
parent::skipIf(!$socket->isOpen(), sprintf('The LiveHttpTestCase requires that a webserver runs at %s:%s', $this->host, $this->port));
}