dongpo8250 2019-08-15 05:45
浏览 94

网站 - >服务器PHP套接字被拒绝,但.NET客户端连接

The program that is running on the server is listening for a connection. It uses TcpListener from .NET. Using netstat, the port is listening.

When using a tester data sender, the connection is accepted and the data is processed. To do the same with PHP sockets does not work properly. It returns errno 111.

Looking for an answer amidst some of the PHP-related socket questions, it was said that it could be one of three things: no http server, TCP queue full, or the firewall.

Web server

$port = 6000;
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, "remote.ip", $port);
socket_send($socket, $data, strlen($data), 1);
socket_close($socket);

Server

tcp = new TcpListener(IPAddress.Any, port);
tcp.Start(backlog);
sock = tcp.AcceptSocket();

Warning: socket_connect(): unable to connect [111]: Connection refused in page.php on line 10

Warning: socket_send(): unable to write to socket [32]: Broken pipe in page.php on line 11

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器