public void TestDualTcpAcceptors() { TcpAcceptor acc1 = new TcpAcceptor(IPAddress.Any, 9999); TcpAcceptor acc2 = new TcpAcceptor(IPAddress.Any, 9999); try { acc1.Start(); try { acc2.Start(); Assert.Fail("Should have thrown a transport error"); } catch (TransportError) { /* do nothing */ } } finally { acc1.Dispose(); acc2.Dispose(); } }
internal NegotiationInProgress(TcpAcceptor acc, TcpClient c) { log = LogManager.GetLogger(GetType()); acceptor = acc; connection = c; state = NIPState.TransportProtocol; data = new byte[4]; // protocol descriptor is 4 bytes offset = 0; try { connection.NoDelay = true; } catch (Exception) {/*ignore*/} }