Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Create()

static EndPoint System.Net.Sockets.IPEndPointExtensions.Create ( this EndPoint thisObj,
System::Net::Internals::SocketAddress socketAddress )
inlinestatic

Definition at line 17 of file IPEndPointExtensions.cs.

18 {
19 AddressFamily family = socketAddress.Family;
20 if (family != thisObj.AddressFamily)
21 {
22 throw new ArgumentException(System.SR.Format(System.SR.net_InvalidAddressFamily, family.ToString(), thisObj.GetType().FullName, thisObj.AddressFamily.ToString()), "socketAddress");
23 }
24 switch (family)
25 {
26 case AddressFamily.InterNetwork:
27 case AddressFamily.InterNetworkV6:
28 if (socketAddress.Size < 8)
29 {
30 throw new ArgumentException(System.SR.Format(System.SR.net_InvalidSocketAddressSize, socketAddress.GetType().FullName, thisObj.GetType().FullName), "socketAddress");
31 }
32 return socketAddress.GetIPEndPoint();
33 case AddressFamily.Unknown:
34 return thisObj;
35 default:
36 {
37 SocketAddress netSocketAddress = GetNetSocketAddress(socketAddress);
38 return thisObj.Create(netSocketAddress);
39 }
40 }
41 }
static SocketAddress GetNetSocketAddress(System.Net.Internals.SocketAddress address)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_InvalidSocketAddressSize
Definition SR.cs:22
static string net_InvalidAddressFamily
Definition SR.cs:20
Definition SR.cs:7

References System.Net.EndPoint.AddressFamily, System.Net.EndPoint.Create(), System.SR.Format(), System.Net.Sockets.IPEndPointExtensions.GetNetSocketAddress(), System.SR.net_InvalidAddressFamily, and System.SR.net_InvalidSocketAddressSize.