コード例 #1
0
 private void ClientOnReceiveMessage(PipeConnection p_Connection, PipeMessage p_Message)
 {
     if (ClientMessage != null)
     {
         ClientMessage(p_Connection, p_Message);
     }
 }
コード例 #2
0
 private void OnReceiveMessage(PipeConnection p_Connection, PipeMessage p_Message)
 {
     if (ServerMessage != null)
     {
         ServerMessage(p_Connection, p_Message);
     }
 }
コード例 #3
0
 private void ClientOnConnected(PipeConnection p_Connection)
 {
     if (ClientConnected != null)
     {
         ClientConnected(p_Connection);
     }
 }
コード例 #4
0
        private void OnDisconnected(PipeConnection p_Connection)
        {
            if (Disconnected != null)
            {
                Disconnected(p_Connection);
            }

            m_Disconnected.Set();

            if (AutoReconnect && !m_ClosedExplicitly)
            {
                Start();
            }
        }
コード例 #5
0
        private void ClientOnDisconnected(PipeConnection p_Connection)
        {
            if (p_Connection == null)
            {
                return;
            }

            lock (m_Connections)
                m_Connections.Remove(p_Connection);

            if (ClientDisconnected != null)
            {
                ClientDisconnected(p_Connection);
            }
        }
コード例 #6
0
        private void ListenSync()
        {
            var s_Handshake    = PipeClientFactory.Connect(m_PipeName);
            var s_DataPipeName = s_Handshake.ReadMessage();

            s_Handshake.Close();

            var s_DataPipe = PipeClientFactory.CreateAndConnectPipe(s_DataPipeName.Content);

            m_Connection = ConnectionFactory.CreateConnection(s_DataPipe);
            m_Connection.Disconnected   += OnDisconnected;
            m_Connection.ReceiveMessage += OnReceiveMessage;
            m_Connection.Open();

            m_Connected.Set();
        }
コード例 #7
0
        private void WaitForConnection(string p_PipeName)
        {
            NamedPipeServerStream s_HandshakePipe = null;
            NamedPipeServerStream s_DataPipe      = null;
            PipeConnection        s_Connection    = null;

            var s_ConnectionPipeName = GetNextConnectionPipeName(p_PipeName);

            try
            {
                s_HandshakePipe = PipeServerFactory.CreateAndConnectPipe(p_PipeName);
                var s_HandshakeWrapper = new PipeStreamWrapper(s_HandshakePipe);
                s_HandshakeWrapper.WriteMessage(new PipeMessage()
                {
                    Module = "SM", Type = "HS", Content = s_ConnectionPipeName
                });
                s_HandshakeWrapper.WaitForPipeDrain();
                s_HandshakeWrapper.Close();

                s_DataPipe = PipeServerFactory.CreatePipe(s_ConnectionPipeName);
                s_DataPipe.WaitForConnection();

                s_Connection = ConnectionFactory.CreateConnection(s_DataPipe);
                s_Connection.ReceiveMessage += ClientOnReceiveMessage;
                s_Connection.Disconnected   += ClientOnDisconnected;
                s_Connection.Open();

                lock (m_Connections)
                    m_Connections.Add(s_Connection);

                ClientOnConnected(s_Connection);
            }
            catch (Exception)
            {
                Cleanup(s_HandshakePipe);
                Cleanup(s_DataPipe);
                ClientOnDisconnected(s_Connection);
            }
        }
コード例 #8
0
ファイル: PipemanClient.cs プロジェクト: OrfeasZ/Statman
 private void OnReceiveMessage(PipeConnection p_Connection, PipeMessage p_Message)
 {
     if (ServerMessage != null)
         ServerMessage(p_Connection, p_Message);
 }
コード例 #9
0
ファイル: PipemanClient.cs プロジェクト: OrfeasZ/Statman
        private void OnDisconnected(PipeConnection p_Connection)
        {
            if (Disconnected != null)
                Disconnected(p_Connection);

            m_Disconnected.Set();

            if (AutoReconnect && !m_ClosedExplicitly)
                Start();
        }
コード例 #10
0
ファイル: PipemanClient.cs プロジェクト: OrfeasZ/Statman
        private void ListenSync()
        {
            var s_Handshake = PipeClientFactory.Connect(m_PipeName);
            var s_DataPipeName = s_Handshake.ReadMessage();
            s_Handshake.Close();

            var s_DataPipe = PipeClientFactory.CreateAndConnectPipe(s_DataPipeName.Content);

            m_Connection = ConnectionFactory.CreateConnection(s_DataPipe);
            m_Connection.Disconnected += OnDisconnected;
            m_Connection.ReceiveMessage += OnReceiveMessage;
            m_Connection.Open();

            m_Connected.Set();
        }
コード例 #11
0
ファイル: PipemanServer.cs プロジェクト: OrfeasZ/Statman
 private void ClientOnReceiveMessage(PipeConnection p_Connection, PipeMessage p_Message)
 {
     if (ClientMessage != null)
         ClientMessage(p_Connection, p_Message);
 }
コード例 #12
0
ファイル: PipemanServer.cs プロジェクト: OrfeasZ/Statman
        private void ClientOnDisconnected(PipeConnection p_Connection)
        {
            if (p_Connection == null)
                return;

            lock (m_Connections)
                m_Connections.Remove(p_Connection);

            if (ClientDisconnected != null)
                ClientDisconnected(p_Connection);
        }
コード例 #13
0
ファイル: PipemanServer.cs プロジェクト: OrfeasZ/Statman
 private void ClientOnConnected(PipeConnection p_Connection)
 {
     if (ClientConnected != null)
         ClientConnected(p_Connection);
 }