Open() public method

public Open ( ) : void
return void
Example #1
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();
        }
Example #2
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);
            }
        }
Example #3
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();
        }