public void Remove_closed_socket() { using (Udt.SocketPoller poller = new Udt.SocketPoller()) { Udt.Socket socket = new Udt.Socket(AddressFamily.InterNetwork, SocketType.Stream); poller.AddSocket(socket); socket.Dispose(); poller.RemoveSocket(socket); } }
public void Remove_socket() { using (Udt.SocketPoller poller = new Udt.SocketPoller()) using (Udt.Socket socket = new Udt.Socket(AddressFamily.InterNetwork, SocketType.Stream)) { socket.Bind(IPAddress.Loopback, 0); socket.Listen(100); ManualResetEvent doneEvent = new ManualResetEvent(false); poller.AddSocket(socket); Assert.IsFalse(poller.Wait(TimeSpan.Zero)); poller.RemoveSocket(socket); Assert.Throws <InvalidOperationException>(() => poller.Wait(TimeSpan.Zero)); } }
public void Remove_socket() { using (Udt.SocketPoller poller = new Udt.SocketPoller()) using (Udt.Socket socket = new Udt.Socket(AddressFamily.InterNetwork, SocketType.Stream)) { socket.Bind(IPAddress.Loopback, 0); socket.Listen(100); ManualResetEvent doneEvent = new ManualResetEvent(false); poller.AddSocket(socket); Assert.IsFalse(poller.Wait(TimeSpan.Zero)); poller.RemoveSocket(socket); Assert.Throws<InvalidOperationException>(() => poller.Wait(TimeSpan.Zero)); } }