swoole-doc
swoole-doc copied to clipboard
05 client.php写错了!
client = new swoole_client(SWOOLE_SOCK_TCP); } public function connect() { if( !$this->client->connect("127.0.0.1", 9501 , 1) ) { echo "Error: {$fp->errMsg}[{$fp->errCode}]\n"; } $msg_normal = "This is a Msg"; $msg_eof = "This is a Msg\r\n"; $msg_length = pack("N" , strlen($msg_eof) ). $msg_eof; $i = 0; while( $i client->send( $msg_length ); $i ++; } } } $client = new Client(); $client->connect();