示例#1
0
 public function testSerialize()
 {
     #fwrite(STDOUT, 'start'."\n");
     #fwrite(STDOUT, 'node'."\n");
     $node = new Node();
     $node->setIdHexStr('cafed00d-2131-4159-8e11-0b4dbadb1738');
     #fwrite(STDOUT, 'tcp client'."\n");
     $client = new TcpClient();
     $client->setId(21);
     $client->setUri('tcp://127.0.0.1:25000');
     $client->setNode($node);
     #fwrite(STDOUT, 'ser'."\n");
     $client = unserialize(serialize($client));
     #ve($client);
     $this->assertEquals(21, $client->getId());
     $this->assertEquals('tcp://127.0.0.1:25000', (string) $client->getUri());
     $this->assertEquals($node, $client->getNode());
     #fwrite(STDOUT, 'end'."\n");
 }
示例#2
0
文件: Server.php 项目: thefox/phpchat
 private function clientNewTcp($socket)
 {
     $this->clientsId++;
     #fwrite(STDOUT, __CLASS__.'->'.__FUNCTION__.': '.$this->clientsId."\n");
     #$this->log->debug('new tcp client: '.$this->clientsId);
     $client = new TcpClient();
     $client->setSocket($socket);
     #$this->log->debug('server ssl setup');
     $client->setSslPrv($this->sslKeyPrvPath, $this->sslKeyPrvPass);
     #$this->log->debug('new tcp client ssl: '.($client->getSsl() ? 'ok' : 'N/A'));
     return $this->clientAdd($client);
 }