private void SendCallback(IAsyncResult ar) { var action = this.SendCompleted; if (action != null) { WebSocketSendEventArgs args; try { this.stream.EndWrite(ar); args = new WebSocketSendEventArgs(ar.AsyncState); } catch (Exception exception) { args = new WebSocketSendEventArgs(exception, ar.AsyncState); } action(this, args); } else { try { this.stream.EndWrite(ar); } catch (Exception) { } } }
private void SendCallback(IAsyncResult ar) { WebSocketSendEventArgs args; try { this.socket.EndSend(ar); args = new WebSocketSendEventArgs(ar.AsyncState); } //catch (Ob catch (Exception exception) { args = new WebSocketSendEventArgs(exception, ar.AsyncState); } // this.Server.OnWebSocketSendCompleted(this, args); }
/// <summary> /// 触发一个消息发送完成事件,置状态失败 /// </summary> /// <param name="args"></param> /// <param name="context"></param> internal protected void OnWebSocketSendCompleted(HttpServerWebSocketContext context, WebSocketSendEventArgs args) { var action = this.WebSocketSendCompleted; if (action != null) { action(context, args); } }