Reading data from the designated TCP ID(session)
int tcp_read(int $tcp_id, string &$rbuf [, int $rlen = MAX_STRING_LEN])
the number of byte to read
<?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(1)
{
$rlen = tcp_read(0, $rbuf); // Reading TCP receiving buffer
if($rlen > 0)
echo "$rbuf\r\n";
}
?>