Exemple #1
0
        public SocketListener(SocketSettings socketSettings)
        {
            this.socketSettings = socketSettings;
            this.prefixHandler  = new PrefixHandler();
            this.messageHandler = new MessageHandler();

            this.bufferManager = new BufferManager(this.socketSettings.BufferSize * this.socketSettings.NumOfSaeaForRecSend, this.socketSettings.BufferSize);

            this.ioEventArgsPool        = new ThreadSafeStack <SocketAsyncEventArgs>(socketSettings.NumOfSaeaForRecSend);
            this.acceptEventArgsPool    = new ThreadSafeStack <SocketAsyncEventArgs>(socketSettings.MaxAcceptOps);
            this.maxConnectionsEnforcer = new Semaphore(this.socketSettings.MaxConnections, this.socketSettings.MaxConnections);
            Init();
            expireTimer = new Timer(CheckExpire, null, socketSettings.ExpireInterval, socketSettings.ExpireInterval);
        }
Exemple #2
0
 public ClientSocket(ClientSocketSettings clientSettings)
 {
     this.clientSettings = clientSettings;
     this.prefixHandler = new PrefixHandler();
     this.messageHandler = new MessageHandler();
 }
Exemple #3
0
        public SocketListener(SocketSettings socketSettings)
        {
            this.socketSettings = socketSettings;
            this.prefixHandler = new PrefixHandler();
            this.messageHandler = new MessageHandler();

            this.bufferManager = new BufferManager(this.socketSettings.BufferSize * this.socketSettings.NumOfSaeaForRecSend, this.socketSettings.BufferSize);

            this.ioEventArgsPool = new ThreadSafeStack<SocketAsyncEventArgs>(socketSettings.NumOfSaeaForRecSend);
            this.acceptEventArgsPool = new ThreadSafeStack<SocketAsyncEventArgs>(socketSettings.MaxAcceptOps);
            this.maxConnectionsEnforcer = new Semaphore(this.socketSettings.MaxConnections, this.socketSettings.MaxConnections);
            Init();
            expireTimer = new Timer(CheckExpire, null, socketSettings.ExpireInterval, socketSettings.ExpireInterval);
        }
Exemple #4
0
 public ClientSocket(ClientSocketSettings clientSettings)
 {
     this.clientSettings = clientSettings;
     this.prefixHandler  = new PrefixHandler();
     this.messageHandler = new MessageHandler();
 }