ı有问题。绑定是警告的条件。警告在这里:警告:socket_bind():无法绑定地址[10048]:通常只允许每个套接字地址(协议/网络地址/端口)使用一种。
如何用代码解决此问题?请帮助我
<?php
$host = "127.0.0.1";
$port = 801;
set_time_limit(0);
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Socket Oluşturulamadı\n");
$result = socket_bind($socket, $host, $port) or die("Bağlanamadı\n");
$result = socket_listen($socket, 3) or die("Dinlemede Hata\n");
$spawn = socket_accept($socket) or die("***\n");
$input = socket_read($spawn, 1024) or die("Giriş Okunamıyor\n");
$input = trim($input);
echo "Client Mesajı : ".$input;
$output = strrev($input) . "\n";
socket_write($spawn, $output, strlen ($output)) or die("Yazılamadı\n");
// close sockets
socket_close($spawn);
socket_close($socket);
?>