public SocketListener(SocketListenerSettings <TU> settings, IMessageHandler <T, TU> messageHandler, IServerTrace <TU> trace = null)
        {
            _settings       = settings;
            _messageHandler = messageHandler;
            _trace          = trace ?? new NullServerTrace <TU>();

            // Create buffer
            var totalBufferSize = settings.IoBufferSize * settings.SendReceiveSocketPoolSize * settings.OperationTypesToPreAllocate;
            var itemBufferSize  = settings.IoBufferSize * settings.OperationTypesToPreAllocate;

            _bufferManager = new BufferManager(totalBufferSize, itemBufferSize);

            // Create socket pool
            _workerPool = new SocketAsyncEventArgsPool(settings.SendReceiveSocketPoolSize);
            _acceptPool = new SocketAsyncEventArgsPool(settings.MaxSimultaneousAcceptOperations);

            // Create watchdog
            _watchDog = new WatchDog <T, TU>(_settings, _trace);

            // Create connection count enforcer
            _maxConnectionsEnforcer = new Semaphore(settings.MaxConnections, settings.MaxConnections);

            _taskManager = new TaskFactory(new LimitedConcurrencyLevelTaskScheduler(settings.MaxTaskConcurrencyLevel));

            Initialise();
        }
Example #2
0
        public WatchDog(SocketListenerSettings <TU> settings, IServerTrace <TU> trace)
        {
            _settings = settings;
            _trace    = trace;

            _activeConnections = new HashSet <SocketAsyncEventArgs>();
            _cts = new CancellationTokenSource();
        }
Example #3
0
 public void StartListen(SocketListenerSettings <TU> settings)
 {
 }
Example #4
0
 public void WatchDogRunning(SocketListenerSettings <TU> settings, long time, double duration, int connectionCount)
 {
 }