다음을 통해 공유


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.Size < 8.

예제

다음 예제에서는 지정된 를 SocketAddress 사용하여 를 만듭니다 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()))

적용 대상

추가 정보