Exemple #1
0
 /**
  * Метод возвращает инстанс стрима для операций записи. Если стрим не инциализирован, то инициализирует его.
  *
  * @return Ext_Io_Net_Stream
  */
 public function getWriteStream()
 {
     if (is_null($this->_writeStream)) {
         $writeOptions = $this->getWriteOptions();
         $this->_writeStream = new Ext_Io_Net_Stream(new Ext_Io_ConnectionString('tcp', $writeOptions['host'], $writeOptions['port']));
         $this->_writeStream->connect($writeOptions['timeout']);
     }
     return $this->_writeStream;
 }
Exemple #2
0
 /**
  * @test
  */
 public function connectAndAcceptWithoutTimeout()
 {
     $testClientStream = new Ext_Io_Net_Stream(new Ext_Io_ConnectionString('tcp', '127.0.0.1', $this->_port));
     $testClientStream->connect();
     $testServerStream = $this->_listenStream->accept();
     $testClientStream->write($this->_testString);
     $this->assertEquals($this->_testString, $testServerStream->read(strlen($this->_testString)));
 }