Home > Backend Development > PHP Tutorial > websocket本地测试通过,但是生产环境下一直连接不上

websocket本地测试通过,但是生产环境下一直连接不上

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:28:41
Original
3609 people have browsed it

使用swoole来做websocket,
开发环境测试通过,测试细节是:

<code>后端:
swoole监听0.0.0.0,端口9503.
html页面使用:
ws//192.168.1.101:9503能够连接,
ws//127.0.0.1:9503能够连接。
</code>
Copy after login
Copy after login

开发环境遇到问题,测试细节是:

<code> 后端:
    swoole监听服务器IP A.B.C.D,端口9503.
    进程开启失败,提示
    [2015-08-12 16:57:23 @9876.0]   WARN    swSocket_listen: bind(
    A.B.C.D:9503) failed. Error: Cannot assign requested address [99]
</code>
Copy after login
Copy after login

第二次尝试:
后端:

<code>swoole监听服务器IP 127.0.0.1,端口9503.进程打开成功。
</code>
Copy after login
Copy after login

前端:

<code>ws//A.B.C.D:9503不能连接,
</code>
Copy after login
Copy after login
Copy after login
Copy after login

第三次尝试:
后端:

<code>swoole监听服务器IP 0.0.0.0,端口9503.进程打开成功。
</code>
Copy after login
Copy after login

前端:

<code>ws//A.B.C.D:9503不能连接,
</code>
Copy after login
Copy after login
Copy after login
Copy after login

毫无头绪,为什么进程开启成功却不能连接。求助!!!

回复内容:

使用swoole来做websocket,
开发环境测试通过,测试细节是:

<code>后端:
swoole监听0.0.0.0,端口9503.
html页面使用:
ws//192.168.1.101:9503能够连接,
ws//127.0.0.1:9503能够连接。
</code>
Copy after login
Copy after login

开发环境遇到问题,测试细节是:

<code> 后端:
    swoole监听服务器IP A.B.C.D,端口9503.
    进程开启失败,提示
    [2015-08-12 16:57:23 @9876.0]   WARN    swSocket_listen: bind(
    A.B.C.D:9503) failed. Error: Cannot assign requested address [99]
</code>
Copy after login
Copy after login

第二次尝试:
后端:

<code>swoole监听服务器IP 127.0.0.1,端口9503.进程打开成功。
</code>
Copy after login
Copy after login

前端:

<code>ws//A.B.C.D:9503不能连接,
</code>
Copy after login
Copy after login
Copy after login
Copy after login

第三次尝试:
后端:

<code>swoole监听服务器IP 0.0.0.0,端口9503.进程打开成功。
</code>
Copy after login
Copy after login

前端:

<code>ws//A.B.C.D:9503不能连接,
</code>
Copy after login
Copy after login
Copy after login
Copy after login

毫无头绪,为什么进程开启成功却不能连接。求助!!!

网络防火墙的问题

IP写错了,swoole无法监听指定的地址和端口。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template