Getting current TCP state of the designated TCP session
int tcp_state(int $tcp_id)
integer number indicating TCP session state (TCP_CLOSED, TCP_CONNECTED or 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";
?>