云服务器SpringBoot 2.x + netty-socketIO 报错 java.net.BindException: Cannot assign requested address: bind

在本地客户端与服务端都是用本机IP可以正常使用
放云服务器上报错java.net.BindException: Cannot assign requested address: bind
起先以为是tomcat启动端口占用报错
发现tomcat启动端口报的错是应该java.net.BindException: Address already in use: JVM_Bind
最后排查发现,是将服务端的配置文件IP与客户端的ws连接IP都填了云服务器的外网映射IP导致socket无法绑定IP地址,最后修改如下:

后台配置文件application.yml中 socketio的host改为云服务器内网IP
云服务器SpringBoot 2.x + netty-socketIO 报错 java.net.BindException: Cannot assign requested address: bind_第1张图片
前台js中连接socketio连接服务器的ip改为云服务器的外网映射IP
云服务器SpringBoot 2.x + netty-socketIO 报错 java.net.BindException: Cannot assign requested address: bind_第2张图片

你可能感兴趣的:(云服务器SpringBoot 2.x + netty-socketIO 报错 java.net.BindException: Cannot assign requested address: bind)