コード例 #1
0
 public void TestSessionEnd(TestSessionEndArgs testSessionEndArgs)
 {
     Log($"TestSession ends.");
     _client?.Dispose();
     _client = null;
     _server.RaiseNewClientEvent -= ConnectionEstablished;
 }
コード例 #2
0
        private void OnConnect(IAsyncResult ar)
        {
            CommunicationChannel session = null;

            lock (_lck)
            {
                try
                {
                    _listener.EndWaitForConnection(ar);
                }
                catch (IOException)
                {
                    return;
                }

                if (_mustShutdown)
                {
                    return;
                }

                if (_listener.IsConnected)
                {
                    session = new CommunicationChannel(_listener, $"S({_channels.Count}):[{PipeName}])");
                    session.SetLogger(OutputToLog);
                    Log($"New connection.");
                    _channels.Add(session);
                    _listener = null;
                    session.RaiseReceivedMessage += Session_RaiseReceivedMessage;
                }
                Listen();
            }
            RaiseNewClientEvent?.Invoke(this, new ConnectionEventArgs(session));
            session.Start();
        }
コード例 #3
0
 private void ConnectionEstablished(object s, ConnectionEventArgs e)
 {
     lock (_lck)
     {
         _client = e.Client;
         _client.RaiseReceivedMessage += ReceivedMutant;
         Monitor.Pulse(_lck);
     }
 }
コード例 #4
0
 public ConnectionEventArgs(CommunicationChannel client)
 {
     this.Client = client;
 }