blog:2021-03-03_c_websock4net_connection_status
2021-03-03 C#: Websock4Net Connection Status
Refer MSDN document, the property status has:
0, None: connection not yet established
1, Connecting: 這個連接正在交涉與遠端端點的信號交換
2, Open: HTTP 信號交換完成之後的初始狀態
3, CloseSent: 關閉訊息已傳送至遠端端點
4, CloseReceived: 接收到來自遠端端點的關閉訊息
5, Closed: 指示 WebSocket 關閉信號交換正常完成
6, Aborted: RFU
Example Code
void SendToWebSocketServer(WebSocket websocket, string str)
{
if (websocket.State == WebSocketState.Open)
{
// 若該 websocket 是連線中
...
}
}
Permalink blog/2021-03-03_c_websock4net_connection_status.txt · Last modified: 2021/03/03 14:08 by
jethro