eof() public method

Determines if the socket resource is at EOF.
public eof ( ) : boolean
return boolean Returns `true` if resource pointer is at its EOF, `false` otherwise.
コード例 #1
0
ファイル: StreamTest.php プロジェクト: EHER/chegamos
 public function testWriteAndRead()
 {
     $stream = new Stream($this->_testConfig);
     $result = $stream->open();
     $data = "GET / HTTP/1.1\r\n";
     $data .= "Host: localhost\r\n";
     $data .= "Connection: Close\r\n\r\n";
     $this->assertTrue($stream->write($data));
     $result = $stream->eof();
     $this->assertFalse($result);
     $result = $stream->read();
     $this->assertPattern("/^HTTP/", $result);
 }
コード例 #2
0
ファイル: StreamTest.php プロジェクト: WarToaster/HangOn
 public function testSendWithObject()
 {
     $stream = new Stream($this->_testConfig);
     $this->assertTrue(is_resource($stream->open()));
     $result = $stream->send(new Request($this->_testConfig), array('response' => 'lithium\\net\\http\\Response'));
     $this->assertTrue($result instanceof Response);
     $this->assertPattern("/^HTTP/", (string) $result);
     $this->assertTrue($stream->eof());
 }