/// 补充断开的连接 public void Supply() { lock (this.pool) { if (ErrCount <= 0) { return; } if (ErrCount > 0) { try { TCPClient tcpClient = new TCPClient() { ListIndex = ItemCount }; ItemCount++; tcpClient.Connect(RemoteIP, RemotePort); this.pool.Enqueue(tcpClient); ErrCount--; } catch (Exception) { } } } }
public TCPClient GetNewTCPClient() { TCPClient tcpClient = new TCPClient() { ListIndex = ItemCount }; tcpClient.Connect(RemoteIP, RemotePort); ItemCount++; return(tcpClient); }