public IPv4EndPoint(IPEndPoint endPoint) { if (endPoint.AddressFamily != AddressFamily.InterNetwork) { throw new ArgumentException("Incompatible address family.", nameof(endPoint)); } Address = new IPv4Address(endPoint.Address); Port = new Port(endPoint.Port); }
public static IPAddress?TryParseV4(ReadOnlySpan <char> text) { Span <byte> addressBytes = stackalloc byte[IPv4Address.ByteCount]; if (IPv4Address.TryParseInto(text, addressBytes)) { return(new IPAddress(addressBytes)); } else { return(null); } }
public IPv4EndPoint(IPv4Address address, Port port) { Address = address; Port = port; }