コード例 #1
0
ファイル: SocketListener.cs プロジェクト: JerryDeveloper/Scut
        /// <summary>
        /// Initializes a new instance of the <see cref="ZyGames.Framework.RPC.Sockets.SocketListener"/> class.
        /// </summary>
        /// <param name="socketSettings">Socket settings.</param>
        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);
        }
コード例 #2
0
ファイル: ClientSocket.cs プロジェクト: haiya/Scut
 /// <summary>
 /// Initializes a new instance of the <see cref="ZyGames.Framework.RPC.Sockets.ClientSocket"/> class.
 /// </summary>
 /// <param name="clientSettings">Client settings.</param>
 public ClientSocket(ClientSocketSettings clientSettings)
 {
     this.clientSettings = clientSettings;
     this.prefixHandler = new PrefixHandler();
     this.messageHandler = new MessageHandler();
 }
コード例 #3
0
 internal SocketAsyncEventArgsProxy(int bufferSize)
 {
     _bufferSize = bufferSize;
     _prefixHandler = new PrefixHandler();
     _messageHandler = new MessageHandler();
 }
コード例 #4
0
 internal SocketAsyncEventArgsProxy(int bufferSize)
 {
     _bufferSize     = bufferSize;
     _prefixHandler  = new PrefixHandler();
     _messageHandler = new MessageHandler();
 }