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); }
public MultiplexedPipeConnection(NamedPipeServerStream pipeServer, QueueBufferedStream multiplexedOutputStream) : base(pipeServer.Write) { this.pipeServer = pipeServer; outputPump = new MultiplexConnectionOutputPump(pipeServer.Read, multiplexedOutputStream.Write, Id); outputPump.BeginRunPump(PumpComplete, null); }
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); }
void PumpCompleted(IAsyncResult asyncResult) { try { MultiplexConnectionOutputPump.EndRunPump(asyncResult); } catch (Exception ex) { Trace.TraceError("Error in pump: {0}", ex.Message); } Dispose(); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (tcpClient != null) { tcpClient.Close(); tcpClient = null; } if (outputPump != null) { outputPump.Dispose(); outputPump = null; } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (pipeServer != null) { pipeServer.Close(); pipeServer = null; } if (outputPump != null) { outputPump.Dispose(); outputPump = null; } }
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(); }
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(); }