public void AddressNotAvailable(string ipAddress) { IPAddress address = IPAddress.Parse(ipAddress); var endPoint = new IPEndPoint(address, Port); Tcp tcp = this.loop.CreateTcp(); // // // It seems that Linux is broken here - bind succeeds // for "127.255.255.255" // if (ipAddress == "127.255.255.255" && Platform.IsLinux) { tcp.Bind(endPoint); } else { var error = Assert.Throws <OperationException>(() => tcp.Bind(endPoint)); Assert.Equal(ErrorCode.EADDRNOTAVAIL, error.ErrorCode); } tcp.CloseHandle(this.OnClose); this.loop.RunDefault(); Assert.Equal(1, this.closeCalled); }
public void Invalid() { IPAddress address = IPAddress.Loopback; var endPoint1 = new IPEndPoint(address, Port); var endPoint2 = new IPEndPoint(address, Port + 1); Tcp tcp = this.loop.CreateTcp(); Assert.Equal(tcp.Bind(endPoint1), tcp); Assert.Throws <OperationException>(() => tcp.Bind(endPoint2)); tcp.CloseHandle(this.OnClose); this.loop.RunDefault(); Assert.Equal(1, this.closeCalled); }
public void LocalHost() { if (!Platform.OSSupportsIPv6) { return; } var endPoint = new IPEndPoint(IPAddress.IPv6Loopback, Port); Tcp tcp = this.loop.CreateTcp(); try { tcp.Bind(endPoint); } catch (OperationException exception) { // IPv6 loop back not available happens on some Linux Assert.Equal(ErrorCode.EADDRNOTAVAIL, exception.ErrorCode); return; } tcp.CloseHandle(this.OnClose); this.loop.RunDefault(); Assert.Equal(1, this.closeCount); }
public void LocalHost() { IPAddress address = IPAddress.Loopback; var endPoint = new IPEndPoint(address, Port); Tcp tcp = this.loop.CreateTcp(); tcp.Bind(endPoint); tcp.Dispose(); }
public void InvalidFlag() { IPAddress address = IPAddress.Loopback; var endPoint = new IPEndPoint(address, Port); Tcp tcp = this.loop.CreateTcp(); Assert.Throws <OperationException>(() => tcp.Bind(endPoint, true)); tcp.Dispose(); }
public void Invalid() { if (!Platform.OSSupportsIPv6) { return; } IPAddress address = IPAddress.Parse("::"); var endPoint1 = new IPEndPoint(address, Port); var endPoint2 = new IPEndPoint(address, Port + 1); Tcp tcp = this.loop.CreateTcp(); Assert.Equal(tcp.Bind(endPoint1), tcp); Assert.Throws <OperationException>(() => tcp.Bind(endPoint2)); tcp.CloseHandle(this.OnClose); this.loop.RunDefault(); Assert.Equal(1, this.closeCount); }
public void AddressNotAvailable() { if (!Platform.OSSupportsIPv6) { return; } IPAddress address = IPAddress.Parse("4:4:4:4:4:4:4:4"); var endPoint = new IPEndPoint(address, Port); Tcp tcp = this.loop.CreateTcp(); Assert.Throws <OperationException>(() => tcp.Bind(endPoint)); tcp.CloseHandle(this.OnClose); this.loop.RunDefault(); Assert.Equal(1, this.closeCount); }