Create a WebSocket: ws://localhost: 5000/ws1
Use the h5 link send everything is normal, if (context. Web sockets. IsWebSocketRequest) this is true on normal interaction
Send abnormal use desktop connection,
Using the component ClientWebSocket connect the if (context. Web sockets. IsWebSocketRequest) this is false cannot interact,
The code is as follows:
String strUrl="ws://127.0.0.1:5000/ws1";
String strMsg="Hello";
Byte [] bytMsg=Encoding. UTF8. GetBytes (strMsg);
ClientWebSocket CWS=new ClientWebSocket ();
CWS. ConnectAsync (new Uri (strUrl) System. The Threading. CancellationToken. None), Wait (0);//removed here wait also is same, error here
CWS. SendAsync (new ArraySegment
CWS. CloseAsync (WebSocketCloseStatus NormalClosure, "1", System. Threading. CancellationToken. None).
CWS. The Dispose ();
In the solution!!!!!
CodePudding user response:
Await the CWS. ConnectAsync (new Uri (strUrl) System. The Threading. CancellationToken. None).
CodePudding user response:
Looked everywhere on the appearance, but the methods how to realize, individual writing?
[/code]