向指定TCP会话(session)发送数据
int tcp_write(int $tcp_id, int/string $wbuf [, int $wlen = MAX_STRING_LEN])
成功时发送数据大小(字节数),失败时0
<?php
include "/lib/sn_tcp_ac.php";
$port = 1470;
tcp_server(0, $port); // listenning the port for a TCP connection (TCP ID: 0)
$rwbuf = "";
while(1)
{
$rwlen = tcp_read(0, $rwbuf); // Reading TCP receiving buffer
if($rwlen > 0)
tcp_write(0, $rwbuf); // transmitting the received data
}
?>