这是我的php套接字读取代码
<?php
$host = "0.0.0.0";
$port = 5060;
set_time_limit(0);
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
$result = socket_listen($socket, 3) or die("Could not set up socket listener\n");
while(1) {
$spawn = socket_accept($socket) or die("Could not accept incoming connection\n");
while ($input = socket_read($spawn, 1024)) {
$input = trim($input);
echo "Client Message : " . $input;
}
socket_close($spawn);
}
socket_close($socket);
?>
我能够telnet localhost 5060
,但我无法telnet 192.168.12.154 5060
。它仅在1次输入后才存在。
可以说什么可能是错的