コード例 #1
0
ファイル: FactoryTest.php プロジェクト: clue/socket-react
 /**
  * creating a TCP socket fails because it is NOT a datagram socket
  */
 public function testCreateClientFailTcp()
 {
     $promise = $this->factory->createClient('tcp://www.google.com:80');
     $this->assertInstanceOf('React\\Promise\\PromiseInterface', $promise);
     $promise->then($this->expectCallableNever(), $this->expectCallableOnceParameter('Exception'));
     $this->loop->tick();
 }
コード例 #2
0
ファイル: ConnectionFactory.php プロジェクト: gries/rcon
 /**
  * Create a new RconConnection
  *
  * @param $host
  * @param $port
  * @param $password
  *
  * @return \gries\Rcon\Connection
  */
 public static function create($host, $port, $password)
 {
     $factory = new \Socket\Raw\Factory();
     $socket = $factory->createClient(sprintf('%s:%s', $host, $port));
     return new \gries\Rcon\Connection($socket, $password);
 }