Exemplo n.º 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];
 }
Exemplo n.º 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());
        }
Exemplo n.º 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();
		}
Exemplo n.º 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];
		}