socket
/* Open a server socket to port 1234 on localhost */$server = stream_socket_server('tcp://127.0.0.1:12345');$socket = stream_socket_accept($server); /* Grab a packet (1500 is a typical MTU size) of OOB data */ echo "Received Out-Of-Band: '" . stream_socket_recvfrom($socket, 1500, STREAM_OOB) . "'\n"; /* Take a peek at the normal in-band data, but don't comsume it. */ echo "Data: '" . stream_socket_recvfrom($socket, 1500, STREAM_PEEK) . "'\n"; /* Get the exact same packet again, but remove it from the buffer this time. */ echo "Data: '" . stream_socket_recvfrom($socket, 1500) . "'\n";/* Close it up */fclose($socket);fclose($server);防火墙放行php了没有?
防火墙放行php了没有? 没安装防火墙啊
不晓得,你的错误信息是超时,就是连接不上
查一下$errno
不晓得,你的错误信息是超时,就是连接不上
查一下$errno 确实是超时。stream_socket_accept($server)的第二个参数为0的时候并不是无限时间。应该放在循环结构里面使用这个函数。初步结论是这样。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号