PHP Socket 初体验
服务端
代码
<?php
$socket = socket_create_listen('55555');
if (!$socket) {
exit('Create Socket Error');
}
while (true) {
$client = socket_accept($socket);
$welcome = "Welcome to the my socket server.";
socket_write($client, $welcome);
}
开始->运行->输入cmd->输入telnet localhost 55555
如果看到 Welcome to the my socket server. 就说明成功了.

浙公网安备 33010602011771号