tcp_state()


返还指定TCP会话的状态

Description

int tcp_state(int $tcp_id)

Parameters

Return Value

体现TCP会话(session)的整数值(TCP_CLOSED, TCP_CONNECTED或是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