Exemple #1
0
 function client()
 {
     $sock = new Socket("tcp://127.0.0.1:8080");
     $sock->write("hello world from socket class\n");
     while (true) {
         echo ".";
         $d = $sock->read(1024, true);
         echo $d;
         usleep(500000);
     }
     $sock->disconnect();
     unset($sock);
     $s2 = stream_socket_client("tcp://127.0.0.1:8080");
     fwrite($s2, "hello world from stream_socket_client\n");
     fclose($s2);
 }