語言

IPEndPoint.Create(SocketAddress) 方法

定義

從一個套接字位址建立端點。

public:
 override System::Net::EndPoint ^ Create(System::Net::SocketAddress ^ socketAddress);
public override System.Net.EndPoint Create(System.Net.SocketAddress socketAddress);
override this.Create : System.Net.SocketAddress -> System.Net.EndPoint
Public Overrides Function Create (socketAddress As SocketAddress) As EndPoint

參數

socketAddress
SocketAddress

SocketAddress用於終端。

傳回

使用指定套接字位址的 EndPoint 實例。

例外狀況

的 socketAddress AddressFamily 並不等於當前實例的 AddressFamily。

-或-

socketAddress.8號。<

範例

以下範例利用指定的 SocketAddress 來建立 IPEndPoint。

// Recreate the connection endpoint from the serialized information.
IPEndPoint endpoint = new IPEndPoint(0,0);
IPEndPoint clonedIPEndPoint = (IPEndPoint) endpoint.Create(socketAddress);
Console.WriteLine("clonedIPEndPoint: " + clonedIPEndPoint.ToString());
' Recreate the connection endpoint from the serialized information.
Dim endpoint As New IPEndPoint(0, 0)
Dim clonedIPEndPoint As IPEndPoint = CType(endpoint.Create(socketAddress), IPEndPoint)
Console.WriteLine(("clonedIPEndPoint: " + clonedIPEndPoint.ToString()))

適用於

另請參閱