예제 #1
0
        ///  补充断开的连接
        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)
                    {
                    }
                }
            }
        }
예제 #2
0
        public TCPClient GetNewTCPClient()
        {
            TCPClient tcpClient = new TCPClient()
            {
                ListIndex = ItemCount
            };

            tcpClient.Connect(RemoteIP, RemotePort);
            ItemCount++;

            return(tcpClient);
        }