예제 #1
0
 public TcpConnection(HostConnectionPool pool, ReusableTcpClient client)
 {
     _pool        = pool;
     _client      = client;
     _stream      = new BufferedStream(client.GetStream());
     _controlTime = DateTime.Now;
     _buffer      = new byte[TcpMessageIO.DefaultStreamBufferSize];
 }
예제 #2
0
        public static TcpConnection GetConnection(string host, int port)
        {
            HostConnectionPool hostPool;

            lock (_pools)
            {
                string key = host + ":" + port;
                hostPool = (HostConnectionPool)_pools[key];
                if (hostPool == null)
                {
                    hostPool    = new HostConnectionPool(host, port);
                    _pools[key] = hostPool;
                }
            }

            return(hostPool.GetConnection());
        }
예제 #3
0
		public static TcpConnection GetConnection (string host, int port)
		{
			HostConnectionPool hostPool;

			lock (_pools)
			{
				string key = host + ":" + port;
				hostPool = (HostConnectionPool) _pools[key];
				if (hostPool == null)
				{
					hostPool = new HostConnectionPool(host, port);
					_pools[key] = hostPool;
				}
			}

			return hostPool.GetConnection();
		}
예제 #4
0
		public TcpConnection (HostConnectionPool pool, ReusableTcpClient client)
		{
			_pool = pool;
			_client = client;
			_stream = new BufferedStream (client.GetStream());
			_controlTime = DateTime.Now;
			_buffer = new byte[TcpMessageIO.DefaultStreamBufferSize];
		}