public static void QueueSend(this Socket socket, SocketSendTask task) { if (socket == null) { throw new ArgumentNullException("socket", "socket cannot be null"); } task.Socket = socket; task.Exception = null; IO.QueueWrite(task); }
private void SendPacket(IPacket packet) { byte[] tmp = Formatter.Format(packet); SocketSendTask task = new SocketSendTask(tmp); task.UserToken = packet; task.Completed += SendComplete; if (Connected) { socket.QueueSend(task); } }
public void SendAsync(IPacket packet, IPEndPoint remoteEp) { byte[] tmp = Formatter.Format(packet); SocketSendTask task = new SocketSendTask(tmp); task.UserToken = packet; task.RemoteEndPoint = remoteEp; task.Completed += SendComplete; if (socket != null) { socket.QueueSend(task); } }