tcp_state()


Getting current TCP state of the designated TCP session

Description

int tcp_state(int $tcp_id)

Parameters

Return Value

integer number indicating TCP session state (TCP_CLOSED, TCP_CONNECTED or TCP_LISTEN)

Example

<?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";
?>

See also