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


PHP SimpleSocket::close方法代码示例

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


在下文中一共展示了SimpleSocket::close方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRecordOfSentCharacters

 public function testRecordOfSentCharacters()
 {
     $socket = new SimpleSocket('www.lastcraft.com', 80, 15);
     $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");
     $socket->close();
     $this->assertEqual($socket->getSent(), "GET /test/network_confirm.php HTTP/1.0\r\n" . "Host: www.lastcraft.com\r\n" . "Connection: close\r\n\r\n");
 }
开发者ID:Clansuite,项目名称:Clansuite,代码行数:9,代码来源:live_test.php

示例2: testRecordOfSentCharacters

 public function testRecordOfSentCharacters()
 {
     $socket = new SimpleSocket($this->host, $this->port, 15);
     $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");
     $socket->close();
     $this->assertEqual($socket->getSent(), "GET /network_confirm.php HTTP/1.0\r\n" . "Host: {$this->host}\r\n" . "Connection: close\r\n\r\n");
 }
开发者ID:simpletest,项目名称:simpletest,代码行数:9,代码来源:live_test.php

示例3: testRecordOfSentCharacters

 function testRecordOfSentCharacters()
 {
     $site = $this->getServerInfo();
     $socket = new SimpleSocket($site['host'], $site['port'], 15);
     $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");
     $socket->close();
     $this->assertEqual($socket->getSent(), "GET {$site['path']}network_confirm.php HTTP/1.0\r\n" . "Host: {$site['host']}\r\n" . "Connection: close\r\n\r\n");
 }
开发者ID:GerHobbelt,项目名称:simpletest,代码行数:10,代码来源:live_test.php

示例4: invoke

 function invoke($method)
 {
     ob_start();
     parent::invoke($method);
     $output = ob_get_contents();
     ob_end_clean();
     $sock = new SimpleSocket("127.0.0.1", $this->_port, 5);
     $sock->write($output);
     $sock->close();
     echo $sock->getError();
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:11,代码来源:eclipse.php

示例5: 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

示例6: createResponse

 /**
  *    Wraps the socket in a response parser.
  *    @param SimpleSocket $socket   Responding socket.
  *    @return SimpleHttpResponse    Parsed response object.
  *    @access protected
  */
 protected function createResponse($socket)
 {
     $response = new SimpleHttpResponse($socket, $this->route->getUrl(), $this->encoding);
     $socket->close();
     return $response;
 }
开发者ID:reevoo,项目名称:reevoomark-php-api,代码行数:12,代码来源:http.php

示例7: run

 /**
  *    Runs the test methods in the test case, or not if the
  *    scorer blocks it.
  *    @param SimpleTest $test_case    Test case to run test on.
  *    @param string $method           Name of test method.
  *    @access public
  */
 function run()
 {
     $methods = get_class_methods(get_class($this->_test_case));
     $invoker =& $this->_test_case->createInvoker();
     foreach ($methods as $method) {
         if (!$this->_isTest($method)) {
             continue;
         }
         if ($this->_isConstructor($method)) {
             continue;
         }
         ob_start();
         echo $this->_start;
         $this->_scorer->paintMethodStart($method);
         if ($this->_scorer->shouldInvoke($this->_test_case->getLabel(), $method)) {
             $invoker->invoke($method);
         }
         $this->_scorer->paintMethodEnd($method);
         echo $this->_end;
         $output = ob_get_contents();
         ob_end_clean();
         $sock = new SimpleSocket("127.0.0.1", $this->_port, 5);
         $sock->write($output);
         $sock->close();
         echo $sock->getError();
     }
 }
开发者ID:sebs,项目名称:simpletest,代码行数:34,代码来源:eclipsetest.php


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