php开发socket模仿c/s结构2008-04-18 09:26:48 来源:中国自学编程网 作者:佚名 点击:
![]() nbsp;socket_read ($socket, 1024); $stdin = fopen (’php://stdin’, ’r’); while (true) { $command = trim (fgets ($stdin, 1024)); socket_write ($socket, $command, strlen ($command)); $msg = trim (socket_read ($socket, 1024)); echo $msg."\n"; if ($msg == "bye-bye") break; } fclose ($stdin); socket_close ($socket); ?> 相关文章: |