Пример #1
0
        public TcpSocketSession(
            TcpClient tcpClient,
            TcpSocketServerConfiguration configuration,
            IBufferManager bufferManager,
            TcpSocketServer server)
        {
            if (tcpClient == null)
                throw new ArgumentNullException("tcpClient");
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            if (bufferManager == null)
                throw new ArgumentNullException("bufferManager");
            if (server == null)
                throw new ArgumentNullException("server");

            _tcpClient = tcpClient;
            _configuration = configuration;
            _bufferManager = bufferManager;
            _server = server;

            _sessionKey = Guid.NewGuid().ToString();
            this.StartTime = DateTime.UtcNow;

            ConfigureClient();

            _remoteEndPoint = Active ? (IPEndPoint)_tcpClient.Client.RemoteEndPoint : null;
            _localEndPoint = Active ? (IPEndPoint)_tcpClient.Client.LocalEndPoint : null;
        }
Пример #2
0
        public TcpSocketSession(
            TcpClient tcpClient,
            TcpSocketServerConfiguration configuration,
            IBufferManager bufferManager,
            TcpSocketServer server)
        {
            if (tcpClient == null)
            {
                throw new ArgumentNullException("tcpClient");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (bufferManager == null)
            {
                throw new ArgumentNullException("bufferManager");
            }
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            _tcpClient     = tcpClient;
            _configuration = configuration;
            _bufferManager = bufferManager;
            _server        = server;

            _sessionKey    = Guid.NewGuid().ToString();
            this.StartTime = DateTime.UtcNow;

            ConfigureClient();

            _remoteEndPoint = Active ? (IPEndPoint)_tcpClient.Client.RemoteEndPoint : null;
            _localEndPoint  = Active ? (IPEndPoint)_tcpClient.Client.LocalEndPoint : null;
        }
Пример #3
0
        public TcpSocketSession(
            TcpClient tcpClient,
            TcpSocketServerConfiguration configuration,
            ISegmentBufferManager bufferManager,
            TcpSocketServer server)
        {
            if (tcpClient == null)
            {
                throw new ArgumentNullException("tcpClient");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (bufferManager == null)
            {
                throw new ArgumentNullException("bufferManager");
            }
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            _tcpClient     = tcpClient;
            _configuration = configuration;
            _bufferManager = bufferManager;
            _server        = server;

            this.StartTime = DateTime.UtcNow;

            SetSocketOptions();

            _remoteEndPoint = this.RemoteEndPoint;
            _localEndPoint  = this.LocalEndPoint;
            _sessionKey     = configuration.SessionKeyBuilder.GetSessionKey(this.RemoteEndPoint.ToString());
        }
Пример #4
0
 public override void Send(string sessionKey, Cowboy.Sockets.TcpSocketServer _server)
 {
     SendFile(sessionKey, _server);
 }