public AsyncWebSocketServer(IPEndPoint listenedEndPoint, AsyncWebSocketServerModuleCatalog catalog, AsyncWebSocketServerConfiguration configuration = null)
        {
            if (listenedEndPoint == null)
                throw new ArgumentNullException("listenedEndPoint");
            if (catalog == null)
                throw new ArgumentNullException("catalog");

            this.ListenedEndPoint = listenedEndPoint;
            _catalog = catalog;
            _configuration = configuration ?? new AsyncWebSocketServerConfiguration();

            Initialize();
        }
Exemple #2
0
        public AsyncWebSocketServer(IPEndPoint listenedEndPoint, AsyncWebSocketServerModuleCatalog catalog, AsyncWebSocketServerConfiguration configuration = null)
        {
            if (listenedEndPoint == null)
            {
                throw new ArgumentNullException("listenedEndPoint");
            }
            if (catalog == null)
            {
                throw new ArgumentNullException("catalog");
            }

            this.ListenedEndPoint = listenedEndPoint;
            _catalog       = catalog;
            _configuration = configuration ?? new AsyncWebSocketServerConfiguration();

            Initialize();
        }
Exemple #3
0
        public AsyncWebSocketSession(
            TcpClient tcpClient,
            AsyncWebSocketServerConfiguration configuration,
            IBufferManager bufferManager,
            AsyncWebSocketRouteResolver routeResolver,
            AsyncWebSocketServer server)
        {
            if (tcpClient == null)
            {
                throw new ArgumentNullException("tcpClient");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (bufferManager == null)
            {
                throw new ArgumentNullException("bufferManager");
            }
            if (routeResolver == null)
            {
                throw new ArgumentNullException("routeResolver");
            }
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

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

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

            _remoteEndPoint = (_tcpClient != null && _tcpClient.Client.Connected) ?
                              (IPEndPoint)_tcpClient.Client.RemoteEndPoint : null;
            _localEndPoint = (_tcpClient != null && _tcpClient.Client.Connected) ?
                             (IPEndPoint)_tcpClient.Client.LocalEndPoint : null;

            _keepAliveTracker      = KeepAliveTracker.Create(KeepAliveInterval, new TimerCallback((s) => OnKeepAlive()));
            _keepAliveTimeoutTimer = new Timer(new TimerCallback((s) => OnKeepAliveTimeout()), null, Timeout.Infinite, Timeout.Infinite);
            _closingTimeoutTimer   = new Timer(new TimerCallback((s) => OnCloseTimeout()), null, Timeout.Infinite, Timeout.Infinite);
        }
Exemple #4
0
        public AsyncWebSocketSession(
            TcpClient tcpClient,
            AsyncWebSocketServerConfiguration configuration,
            ISegmentBufferManager bufferManager,
            AsyncWebSocketRouteResolver routeResolver,
            AsyncWebSocketServer server)
        {
            if (tcpClient == null)
            {
                throw new ArgumentNullException("tcpClient");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (bufferManager == null)
            {
                throw new ArgumentNullException("bufferManager");
            }
            if (routeResolver == null)
            {
                throw new ArgumentNullException("routeResolver");
            }
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

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

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

            _remoteEndPoint = (_tcpClient != null && _tcpClient.Client.Connected) ?
                              (IPEndPoint)_tcpClient.Client.RemoteEndPoint : null;
            _localEndPoint = (_tcpClient != null && _tcpClient.Client.Connected) ?
                             (IPEndPoint)_tcpClient.Client.LocalEndPoint : null;
        }
Exemple #5
0
        public AsyncWebSocketServer(IPEndPoint listenedEndPoint, AsyncWebSocketServerModuleCatalog catalog, AsyncWebSocketServerConfiguration configuration = null)
        {
            if (listenedEndPoint == null)
            {
                throw new ArgumentNullException("listenedEndPoint");
            }
            if (catalog == null)
            {
                throw new ArgumentNullException("catalog");
            }

            this.ListenedEndPoint = listenedEndPoint;
            _catalog       = catalog;
            _configuration = configuration ?? new AsyncWebSocketServerConfiguration();

            if (_configuration.BufferManager == null)
            {
                throw new InvalidProgramException("The buffer manager in configuration cannot be null.");
            }

            Initialize();
        }
        public AsyncWebSocketSession(
            TcpClient tcpClient,
            AsyncWebSocketServerConfiguration configuration,
            IBufferManager bufferManager,
            AsyncWebSocketRouteResolver routeResolver,
            AsyncWebSocketServer server)
        {
            if (tcpClient == null)
                throw new ArgumentNullException("tcpClient");
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            if (bufferManager == null)
                throw new ArgumentNullException("bufferManager");
            if (routeResolver == null)
                throw new ArgumentNullException("routeResolver");
            if (server == null)
                throw new ArgumentNullException("server");

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

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

            _remoteEndPoint = (_tcpClient != null && _tcpClient.Client.Connected) ?
                    (IPEndPoint)_tcpClient.Client.RemoteEndPoint : null;
            _localEndPoint = (_tcpClient != null && _tcpClient.Client.Connected) ?
                    (IPEndPoint)_tcpClient.Client.LocalEndPoint : null;

            _keepAliveTracker = KeepAliveTracker.Create(KeepAliveInterval, new TimerCallback((s) => OnKeepAlive()));
            _keepAliveTimeoutTimer = new Timer(new TimerCallback((s) => OnKeepAliveTimeout()), null, Timeout.Infinite, Timeout.Infinite);
            _closingTimeoutTimer = new Timer(new TimerCallback((s) => OnCloseTimeout()), null, Timeout.Infinite, Timeout.Infinite);
        }
 public AsyncWebSocketServer(IPAddress listenedAddress, int listenedPort, AsyncWebSocketServerModuleCatalog catalog, AsyncWebSocketServerConfiguration configuration = null)
     : this(new IPEndPoint(listenedAddress, listenedPort), catalog, configuration)
 {
 }
 public AsyncWebSocketServer(int listenedPort, AsyncWebSocketServerModuleCatalog catalog, AsyncWebSocketServerConfiguration configuration = null)
     : this(IPAddress.Any, listenedPort, catalog, configuration)
 {
 }
Exemple #9
0
 public AsyncWebSocketServer(IPAddress listenedAddress, int listenedPort, AsyncWebSocketServerModuleCatalog catalog, AsyncWebSocketServerConfiguration configuration = null)
     : this(new IPEndPoint(listenedAddress, listenedPort), catalog, configuration)
 {
 }
Exemple #10
0
 public AsyncWebSocketServer(int listenedPort, AsyncWebSocketServerModuleCatalog catalog, AsyncWebSocketServerConfiguration configuration = null)
     : this(IPAddress.Any, listenedPort, catalog, configuration)
 {
 }