Ejemplo n.º 1
0
        private void InitClientSession(IntPtr acceptSocket)
        {
            var clientSession = _sessionManager.Acquire();

            clientSession.Closed += OnClientSessionClosed;

            clientSession.Open(acceptSocket);
            clientSession.HandshakeReceived += OnHandshakeReceived;
            clientSession.InitiateReceiving(_requestProcessingEngine);

            _handshakeSignal.WaitOne();

            ClientConnected?.Invoke(clientSession.PeerId);
        }
Ejemplo n.º 2
0
        public ZerioClient(IPEndPoint serverEndpoint, ZerioClientConfiguration clientConfiguration = null)
        {
            _serverEndpoint = serverEndpoint;

            WinSock.EnsureIsInitialized();

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

            _sendRequestProcessingEngine = CreateSendRequestProcessingEngine();
            _receiveCompletionProcessor  = CreateReceiveCompletionProcessor();

            _session = _sessionManager.Acquire();
            _session.HandshakeReceived += OnHandshakeReceived;
            _session.Closed            += OnSessionClosed;
        }