protected virtual void SendComplete(object sender, IOTaskCompleteEventArgs <SocketSendTask> e) { e.Task.Completed -= SendComplete; var msg = (IPacket)e.Task.UserToken; if (msg.Id == (byte)AresId.MSG_CHAT_SERVER_HTML) { } if (e.Task.Exception == null) { Monitor.AddOutput(e.Task.Transferred); try { PacketSent?.Invoke(this, new PacketEventArgs(msg, MessageType, e.Task.Transferred)); if (IsConnected) { SendQueue(); } } catch (Exception ex) { OnException(ex); } } else { OnException(e.Task.Exception); } }
private void SendComplete(object sender, IOTaskCompleteEventArgs <SocketSendTask> e) { e.Task.Completed -= SendComplete; if (e.Task.Exception == null) { Monitor.AddOutput(e.Task.Transferred); try { var msg = (IPacket)e.Task.UserToken; var complete = PacketSent; if (complete != null) { complete(this, new PacketEventArgs(msg, e.Task.Transferred, e.Task.RemoteEndPoint)); } } catch (Exception ex) { OnException(ex, e.Task.RemoteEndPoint); } } else { OnException(e.Task.Exception, e.Task.RemoteEndPoint); } }
private void SendComplete(object sender, IOTaskCompleteEventArgs <SocketSendTask> e) { sending = false; e.Task.Completed -= SendComplete; if (e.Task.Exception == null) { Monitor.AddOutput(e.Task.Transferred); try { var msg = (IPacket)e.Task.UserToken; var complete = PacketSent; if (complete != null) { complete(this, new PacketEventArgs(msg, e.Task.Transferred)); } if (Connected) { SendQueue(); } } catch (Exception ex) { OnException(ex); } } else { OnException(e.Task.Exception); } }
private void SendComplete(object sender, IOTaskCompleteEventArgs <SocketSendTask> e) { e.Task.Completed -= sendHandler; if (e.Task.Exception == null) { Monitor.AddOutput(e.Task.Transferred); try { var msg = (IPacket)e.Task.UserToken; PacketSent?.Invoke(this, new PacketEventArgs(msg, WebSocketMessageType.Binary, e.Task.Transferred, e.Task.RemoteEndPoint)); } catch (Exception ex) { OnException(ex, e.Task.RemoteEndPoint); } } else { OnException(e.Task.Exception, e.Task.RemoteEndPoint); } }