简体   繁体   English

从LAN访问ws套接字服务器

[英]Accessing to the ws socket server from LAN

I'm trying to access to my websocket server which runs on Apache 2.4.9 on my computer. 我正在尝试访问在我的计算机上的Apache 2.4.9上运行的websocket服务器。 So here is the config. 所以这是配置。 Apache listens all connections from any IP addresses on 8081 port. Apache监听来自8081端口上任何IP地址的所有连接。 So I can access to it using localhost:8081 or my static IP 192.168.1.1:8081. 因此,我可以使用localhost:8081或我的静态IP 192.168.1.1:8081访问它。 And everything is fine, I can open php webpages BUT. 一切都很好,但是我可以打开php网页。

There's one php file which listens to ws connections. 有一个php文件,用于监听ws连接。 It listens 2012 port for connections. 它监听2012端口的连接。 So here is the issue, I can connect to it using localhost:2012, but cant connect using my static IP address like 192.168.1.1:2012. 所以这里是问题,我可以使用localhost:2012连接到它,但是不能使用我的静态IP地址(例如192.168.1.1:2012)连接。

Firewall has rules for incoming tcp connection from all addresses to the 2012 and 8081 ports. 防火墙具有从所有地址到2012和8081端口的传入TCP连接的规则。 I have tried completely disable it. 我尝试完全禁用它。 Not worked. 没用。

What should I do in this case? 在这种情况下我该怎么办?

By not putting in the second parm it's only listeing on localhost(127.0.0.1). 通过不放入第二个参数,它仅在localhost(127.0.0.1)上列出。

$webSock->listen(2012, '0.0.0.0'); 
   // Binding to 0.0.0.0 will bind to all interfaces and allow remotes to connect

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM