Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DnsEndPoint.cs
Go to the documentation of this file.
3
4namespace System.Net;
5
6public class DnsEndPoint : EndPoint
7{
8 private readonly string _host;
9
10 private readonly int _port;
11
12 private readonly AddressFamily _family;
13
14 public string Host => _host;
15
17
18 public int Port => _port;
19
20 public DnsEndPoint(string host, int port)
21 : this(host, port, AddressFamily.Unspecified)
22 {
23 }
24
25 public DnsEndPoint(string host, int port, AddressFamily addressFamily)
26 {
27 if (host == null)
28 {
29 throw new ArgumentNullException("host");
30 }
31 if (string.IsNullOrEmpty(host))
32 {
34 }
35 if (port < 0 || port > 65535)
36 {
37 throw new ArgumentOutOfRangeException("port");
38 }
39 if (addressFamily != AddressFamily.InterNetwork && addressFamily != AddressFamily.InterNetworkV6 && addressFamily != 0)
40 {
42 }
43 _host = host;
44 _port = port;
45 _family = addressFamily;
46 }
47
48 public override bool Equals([NotNullWhen(true)] object? comparand)
49 {
50 if (!(comparand is DnsEndPoint dnsEndPoint))
51 {
52 return false;
53 }
54 if (_family == dnsEndPoint._family && _port == dnsEndPoint._port)
55 {
56 return _host == dnsEndPoint._host;
57 }
58 return false;
59 }
60
61 public override int GetHashCode()
62 {
63 return StringComparer.OrdinalIgnoreCase.GetHashCode(ToString());
64 }
65
66 public override string ToString()
67 {
68 return _family.ToString() + "/" + _host + ":" + _port;
69 }
70}
readonly string _host
Definition DnsEndPoint.cs:8
override bool Equals([NotNullWhen(true)] object? comparand)
readonly AddressFamily _family
override string ToString()
DnsEndPoint(string host, int port)
override int GetHashCode()
DnsEndPoint(string host, int port, AddressFamily addressFamily)
static string net_sockets_invalid_optionValue_all
Definition SR.cs:24
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_emptystringcall
Definition SR.cs:14
Definition SR.cs:7
static StringComparer OrdinalIgnoreCase