tcp_txfree()


返还指定TCP会话(sessions)的发送缓冲器的空空间

Description

int tcp_txfree(int $tcp_id)

Parameters

Return Value

成功时发送缓冲器空空间(字节数) ,失败时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