Bagikan melalui


IPEndPoint.Create(SocketAddress) Metode

Definisi

Membuat titik akhir dari alamat soket.

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

Parameter

socketAddress
SocketAddress

yang SocketAddress digunakan untuk titik akhir.

Mengembalikan

Instans EndPoint menggunakan alamat soket yang ditentukan.

Pengecualian

AddressFamily tidak socketAddress sama dengan AddressFamily dari instans saat ini.

-atau-

socketAddress. Ukuran < 8.

Contoh

Contoh berikut menggunakan yang ditentukan SocketAddress untuk membuat IPEndPoint.

// Recreate the connection endpoint from the serialized information.
IPEndPoint^ endpoint = gcnew IPEndPoint( (__int64)0,0 );
IPEndPoint^ clonedIPEndPoint = dynamic_cast<IPEndPoint^>(endpoint->Create( socketAddress ));
Console::WriteLine( "clonedIPEndPoint: {0}", clonedIPEndPoint );
// 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()))

Berlaku untuk

Lihat juga