我正在使用Websocket4Net连接到服务器,当我发送一条消息时,我收到该消息的回复,当我发送第二条消息时,我确实得到了回复!
当我重新启动连接,并再次发送第二条消息时,我收到了回复!
因此,在同一会话中,我只收到对第一条发送消息的回复,而不会收到对第二条、第三条消息的回复。
这是我用来连接到服务器的代码:
WSIWebSocket = New WebSocket(FinalURL)
WSIWebSocket.Security.AllowNameMismatchCertificate = True
WSIWebSocket.Security.AllowCertificateChainErrors = True
WSIWebSocket.Security.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls
WSIWebSocket.Security.AllowUnstrustedCertificate = True
AddHandler WSIWebSocket.Opened, AddressOf WSIWebSocket_Opened
AddHandler WSIWebSocket.Error, AddressOf WSIWebSocket_Error
AddHandler WSIWebSocket.Closed, AddressOf WSIWebSocket_Closed
AddHandler WSIWebSocket.MessageReceived, AddressOf WSIWebSocket_MessageReceived
WSIWebSocket.Open()发布于 2018-10-03 05:27:46
我已经找到了我没有得到第二条消息回复的原因,在第一条消息回复中,我确实连接到了DB2数据库,在那里应用程序挂起了几秒钟,这导致web socket对象无法发送keep alive ping,并将被服务器视为断开连接。
https://stackoverflow.com/questions/52610867
复制相似问题