我有一個Spring Boot應用程序,它實現了一個Websocket服務器(SockJS)。沒有互聯網接入的Websocket連接(Ubuntu)
只要主機應用程序的Ubuntu機器具有Internet訪問權限,我就可以將客戶機連接到本地網絡上的該服務器。
2016-10-27 11:22:20.802 DEBUG 9390 --- [nio-8085-exec-9] o.a.coyote.http11.Http11NioProtocol : Socket: [[email protected]:[email protected]:java.nio.channels.SocketChannel[connected local=/192.168.1.104:8085 remote=/192.168.1.106:51946]], Status in: [OPEN_READ], State out: [CLOSED]
2016-10-27 11:22:20.849 DEBUG 9390 --- [io-8085-exec-10] d.f.util.ConnectivityCheckUtil : Local network interface found: wlp2s0 192.168.1.104 2016-10-27 11:22:20.850 DEBUG 9390 --- [io-8085-exec-10] d.f.util.ConnectivityCheckUtil : Your ip is: 192.168.1.104
2016-10-27 11:22:20.850 DEBUG 9390 --- [io-8085-exec-10] d.f.i.v.b.i.w.s.BrokerWebsocketHandler : Connected ... t0obkpdo 2016-10-27 11:22:20.851 INFO 9390 --- [io-8085-exec-10] d.f.i.v.b.i.w.s.BrokerWebsocketHandler : websocketTextmessagesize = 1000000
2016-10-27 11:22:20.852 DEBUG 9390 --- [io-8085-exec-10] o.a.coyote.http11.Http11NioProtocol : Socket: [[email protected]:[email protected]:java.nio.channels.SocketChannel[connected local=192.168.1.104/192.168.1.104:8085 remote=/192.168.1.106:51947]], Status in: [OPEN_READ], State out: [UPGRADING]
2016-10-27 11:22:20.852 DEBUG 9390 --- [io-8085-exec-10] o.a.coyote.http11.Http11NioProtocol : Socket: [[email protected]:[email protected]:java.nio.channels.SocketChannel[connected local=192.168.1.104/192.168.1.104:8085 remote=/192.168.1.106:51947]], Status in: [OPEN_READ], State out: [UPGRADED]
我拉我的WAN網絡路由器上插入的那一刻,服務器會刪除所有WS連接,也不允許新的。客戶端將報告錯誤代碼2000'All transports failed'。正如我在插上WAN電纜背部和路由器再次擁有互聯網接入,WS連接,重新開始工作一旦
2016-10-27 11:18:38.380 DEBUG 9390 --- [nio-8085-exec-1] o.a.coyote.http11.Http11NioProtocol : Socket: [[email protected]:[email protected]:java.nio.channels.SocketChannel[closed]], Status in: [OPEN_READ], State out: [CLOSED]
2016-10-27 11:18:51.396 DEBUG 9390 --- [nio-8085-exec-2] o.a.coyote.http11.Http11NioProtocol : Socket: [[email protected]:[email protected]:java.nio.channels.SocketChannel[connected local=/192.168.1.104:8085 remote=/192.168.1.106:51692]], Status in: [OPEN_READ], State out: [CLOSED]
2016-10-27 11:19:01.437 DEBUG 9390 --- [nio-8085-exec-6] o.a.coyote.http11.Http11NioProtocol : Socket: [[email protected]:[email protected]:java.nio.channels.SocketChannel[connected local=192.168.1.104/192.168.1.104:8085 remote=/192.168.1.106:51693]], Status in: [OPEN_READ], State out: [CLOSED]
2016-10-27 11:19:02.141 DEBUG 9390 --- [nio-8085-exec-3] d.f.util.ConnectivityCheckUtil : Local network interface found: wlp2s0 192.168.1.104
2016-10-27 11:19:02.142 DEBUG 9390 --- [nio-8085-exec-3] d.f.util.ConnectivityCheckUtil : Your ip is: 192.168.1.104
2016-10-27 11:19:02.144 DEBUG 9390 --- [nio-8085-exec-3] d.f.i.v.b.i.w.s.BrokerWebsocketHandler : Connected ... 2cbhftw3
2016-10-27 11:19:02.144 INFO 9390 --- [nio-8085-exec-3] d.f.i.v.b.i.w.s.BrokerWebsocketHandler : websocketTextmessagesize = 1000000
2016-10-27 11:19:02.147 DEBUG 9390 --- [nio-8085-exec-3] d.f.i.v.b.i.w.s.BrokerWebsocketHandler : Session 2cbhftw3 closed because of CloseStatus[code=1011, reason=null]
2016-10-27 11:19:02.149 ERROR 9390 --- [nio-8085-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri= http://192.168.1.104:8085/websocket/data/421/2cbhftw3/xhr_streaming ; nested exception is org.springframework.web.socket.sockjs.SockJsTransportFailureException: Failed to open session; nested exception is org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe] with root cause
java.io.IOException: Broken pipe
:
服務器將拋出此錯誤。我已經在Netgear和TP-Link的多個路由器上試過了。
我已經嘗試在ubuntu下手動設置網絡接口設置,但這沒有幫助。
任何想法可能會造成這種情況?
BR 丹尼爾