Esempio n. 1
0
 public MultiplexedTcpConnection(TcpClient tcpClient, Stream multiplexedOutputStream)
     : base(tcpClient.GetStream().Write)
 {
     this.tcpClient = tcpClient;
     outputPump     = new MultiplexConnectionOutputPump(tcpClient.GetStream().Read, multiplexedOutputStream.Write, Id);
     outputPump.BeginRunPump(PumpComplete, null);
 }
Esempio n. 2
0
 public MultiplexedPipeConnection(NamedPipeServerStream pipeServer, QueueBufferedStream multiplexedOutputStream)
     : base(pipeServer.Write)
 {
     this.pipeServer = pipeServer;
     outputPump      = new MultiplexConnectionOutputPump(pipeServer.Read, multiplexedOutputStream.Write, Id);
     outputPump.BeginRunPump(PumpComplete, null);
 }
Esempio n. 3
0
        public MultiplexedServiceTcpConnection(StreamConnection streamConnection, TcpClient tcpClient, int connectionId)
            : base(tcpClient.GetStream().Write, connectionId)
        {
            this.streamConnection = streamConnection;
            this.tcpClient        = tcpClient;

            outputPump = new MultiplexConnectionOutputPump(tcpClient.GetStream().Read, streamConnection.Stream.Write, connectionId);
            outputPump.BeginRunPump(PumpCompleted, null);
        }
        public MultiplexedServiceNamedPipeConnection(StreamConnection streamConnection, NamedPipeClientStream pipeClient, int connectionId)
            : base(pipeClient.Write, connectionId)
        {
            this.streamConnection = streamConnection;
            this.pipeClient       = pipeClient;

            outputPump = new MultiplexConnectionOutputPump(pipeClient.Read, streamConnection.Stream.Write, connectionId);
            outputPump.BeginRunPump(PumpCompleted, null);
        }
Esempio n. 5
0
 void PumpCompleted(IAsyncResult asyncResult)
 {
     try
     {
         MultiplexConnectionOutputPump.EndRunPump(asyncResult);
     }
     catch (Exception ex)
     {
         Trace.TraceError("Error in pump: {0}", ex.Message);
     }
     Dispose();
 }
Esempio n. 6
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (tcpClient != null)
     {
         tcpClient.Close();
         tcpClient = null;
     }
     if (outputPump != null)
     {
         outputPump.Dispose();
         outputPump = null;
     }
 }
Esempio n. 7
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (pipeServer != null)
     {
         pipeServer.Close();
         pipeServer = null;
     }
     if (outputPump != null)
     {
         outputPump.Dispose();
         outputPump = null;
     }
 }
Esempio n. 8
0
        void PumpComplete(IAsyncResult a)
        {
            try
            {
                MultiplexConnectionOutputPump.EndRunPump(a);
            }
            catch (Exception ex)
            {
                Trace.TraceError("Failure in multiplex pump: {0}", ex.Message);
            }

            this.Closed?.Invoke(this, EventArgs.Empty);

            Dispose();
        }
Esempio n. 9
0
        void PumpComplete(IAsyncResult a)
        {
            try
            {
                MultiplexConnectionOutputPump.EndRunPump(a);
            }
            catch (Exception ex)
            {
                Trace.TraceError("Failure in multiplex pump: {0}", ex.Message);
            }

            if (Closed != null)
            {
                Closed(this, new EventArgs());
            }

            Dispose();
        }