当前位置: 首页>>代码示例>>PHP>>正文


PHP SimpleSocket::read方法代码示例

本文整理汇总了PHP中SimpleSocket::read方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSocket::read方法的具体用法?PHP SimpleSocket::read怎么用?PHP SimpleSocket::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleSocket的用法示例。


在下文中一共展示了SimpleSocket::read方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:Clansuite,项目名称:Clansuite,代码行数:11,代码来源:live_test.php

示例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);
 }
开发者ID:simpletest,项目名称:simpletest,代码行数:11,代码来源:live_test.php

示例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), "");
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:12,代码来源:live_test.php

示例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);
 }
开发者ID:GerHobbelt,项目名称:simpletest,代码行数:12,代码来源:live_test.php

示例5: while

 /**
  *    Reads the whole of the socket output into a
  *    single string.
  *    @param SimpleSocket $socket  Unread socket.
  *    @return string               Raw output if successful
  *                                 else false.
  *    @access private
  */
 function _readAll(&$socket)
 {
     $all = '';
     while (!$this->_isLastPacket($next = $socket->read())) {
         $all .= $next;
     }
     return $all;
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:16,代码来源:http.php

示例6: readAll

 /**
  *    Reads the whole of the socket output into a
  *    single string.
  *    @param SimpleSocket $socket  Unread socket.
  *    @return string               Raw output if successful
  *                                 else false.
  *    @access private
  */
 protected function readAll($socket)
 {
     $all = '';
     while (!$this->isLastPacket($next = $socket->read())) {
         $all .= $next;
     }
     return $all;
 }
开发者ID:reevoo,项目名称:reevoomark-php-api,代码行数:16,代码来源:http.php

示例7: while

 /**
  *    Reads the whole of the socket output into a
  *    single string.
  *    @param SimpleSocket $socket  Unread socket.
  *    @return string               Raw output if successful
  *                                 else false.
  *    @access private
  */
 function _readAll(&$socket) {
     $all = "";
     while ($next = $socket->read()) {
         $all .= $next;
     }
     return $all;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:15,代码来源:http.php


注:本文中的SimpleSocket::read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。