返还指定TCP会话的状态
int tcp_state(int $tcp_id)
体现TCP会话(session)的整数值(TCP_CLOSED, TCP_CONNECTED或是TCP_LISTEN)
<?php
include "/lib/sn_tcp_ac.php";
$port = 1470;
tcp_server(0, $port); // listenning the port for a TCP connection (TCP ID: 0)
$rbuf = "";
while(tcp_state(0) != TCP_CONNECTED)
;
echo "TCP connected!\r\n";
?>