public void Return(Socket s) { SocketBag bag = new SocketBag(s, DateTime.Now); lock (this.queue) { this.queue.Enqueue(bag); } }
public Socket Get() { SocketBag bag = null; lock (this.queue) { if (this.queue.Count > 0) { bag = this.queue.Dequeue(); } } if (bag != null) { return(bag.socket); } return(GetNew()); }