tcp_read()


Reading data from the designated TCP ID(session)

Description

int tcp_read(int $tcp_id, string &$rbuf [, int $rlen = MAX_STRING_LEN])

Parameters

Return Value

the number of byte to read

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(1)
{
  $rlen = tcp_read(0, $rbuf); // Reading TCP receiving buffer
  if($rlen > 0)
    echo "$rbuf\r\n"; 
}
?>

See also