예제 #1
0
        private static ZerioConfiguration CreateConfiguration()
        {
            var zerioConfiguration = ZerioConfiguration.CreateDefault();

            zerioConfiguration.SessionCount = 1;
            return(zerioConfiguration);
        }
예제 #2
0
        public static ZerioConfiguration CreateDefault()
        {
            // const int allocationGranularity = 65536;
            var configuration = new ZerioConfiguration
            {
                MaxSendBatchSize = 16,
                SessionCount     = 2,

                SendingBufferLength = 1024,
                SendingBufferCount  = 64 * 1024,

                ReceivingBufferLength = 64 * 1024,
                ReceivingBufferCount  = 4,

                RequestEngineWaitStrategyType            = RequestEngineWaitStrategyType.HybridWaitStrategy,
                ReceiveCompletionPollingWaitStrategyType = CompletionPollingWaitStrategyType.BusySpinWaitStrategy,
                SendCompletionPollingWaitStrategyType    = CompletionPollingWaitStrategyType.SpinWaitWaitStrategy,
            };

            configuration.FramingBufferLength         = configuration.ReceivingBufferLength;
            configuration.MaxSendCompletionResults    = configuration.SendingBufferCount;
            configuration.MaxReceiveCompletionResults = configuration.ReceivingBufferCount;

            return(configuration);
        }
예제 #3
0
        public ZerioServer(int listeningPort)
        {
            WinSock.EnsureIsInitialized();

            _listeningPort = listeningPort;

            _configuration    = CreateConfiguration();
            _completionQueues = CreateCompletionQueues();
            _sessionManager   = CreateSessionManager();

            _requestProcessingEngine    = CreateRequestProcessingEngine();
            _receiveCompletionProcessor = CreateReceiveCompletionProcessor();

            _listeningSocket = CreateListeningSocket();
        }
예제 #4
0
        public ZerioClient(IPEndPoint serverEndpoint)
        {
            _serverEndpoint = serverEndpoint;

            WinSock.EnsureIsInitialized();

            _configuration    = CreateConfiguration();
            _completionQueues = CreateCompletionQueues();
            _sessionManager   = CreateSessionManager();

            _requestProcessingEngine    = CreateRequestProcessingEngine();
            _receiveCompletionProcessor = CreateReceiveCompletionProcessor();

            _session = _sessionManager.Acquire();
            _session.HandshakeReceived += OnHandshakeReceived;
            _session.Closed            += OnSessionClosed;
        }
예제 #5
0
 private static ZerioConfiguration CreateConfiguration()
 {
     return(ZerioConfiguration.CreateDefault());
 }