public virtual void Listen(int backlog) { if (Socket == null) { Socket = SocketManager.CreateTcp(); outQueue = new ConcurrentQueue <IPacket>(); Monitor.Start(); } Socket.Listen(backlog); SocketAcceptTask task = new SocketAcceptTask(); task.Completed += AcceptComplete; Socket.QueueAccept(task); }
public void QueueAccept(SocketAcceptTask task) { lock (acceptQueue) acceptQueue.Enqueue(task); }
public static void QueueAccept(this Socket socket, SocketAcceptTask task) { task.Socket = socket ?? throw new ArgumentNullException("socket", "socket cannot be null"); task.Exception = null; IO.QueueAccept(task); }