tcp_txfree()


Getting free buffer space of the designated TCP sessions TX buffer

Description

int tcp_txfree(int $tcp_id)

Parameters

Return Value

On success, it returns free TX buffer length of the TCP session, otherwise 0

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)
{
  // Reading the TCP data as many as the TCP TX buffer free or less
  $rlen = tcp_read(0, $rbuf, tcp_txfree(0));
  if($rlen > 0)
    echo "$rbuf\r\n"; 
}
?>

See also