/// <summary> Creates a new instance of Connection, with inbound communication on one /// port and outbound on another. /// </summary> public NuGenConnection(Parser parser, LowerLayerProtocol llp, System.Net.Sockets.TcpClient inbound, System.Net.Sockets.TcpClient outbound) { init(parser); ackWriter = llp.getWriter(inbound.GetStream()); sendWriter = llp.getWriter(outbound.GetStream()); sockets.Add(outbound); //always add outbound first ... see getRemoteAddress() sockets.Add(inbound); NuGenReceiver inRec = new NuGenReceiver(this, llp.getReader(inbound.GetStream())); NuGenReceiver outRec = new NuGenReceiver(this, llp.getReader(outbound.GetStream())); inRec.start(); outRec.start(); receivers.Add(inRec); receivers.Add(outRec); this.initiator = new NuGenInitiator(this); }
/// <summary> Creates a new instance of Connection, with inbound and outbound /// communication on a single port. /// </summary> public NuGenConnection(Parser parser, LowerLayerProtocol llp, System.Net.Sockets.TcpClient bidirectional) { init(parser); ackWriter = llp.getWriter(bidirectional.GetStream()); sendWriter = ackWriter; sockets.Add(bidirectional); NuGenReceiver r = new NuGenReceiver(this, llp.getReader(bidirectional.GetStream())); r.start(); receivers.Add(r); this.initiator = new NuGenInitiator(this); }