次の方法で共有


IPEndPoint.Create メソッド

ソケット アドレスからエンドポイントを作成します。

Overrides Public Function Create( _
   ByVal socketAddress As SocketAddress _) As EndPoint
[C#]
public override EndPoint Create(SocketAddresssocketAddress);
[C++]
public: EndPoint* Create(SocketAddress* socketAddress);
[JScript]
public override function Create(
   socketAddress : SocketAddress) : EndPoint;

パラメータ

  • socketAddress
    エンドポイントで使用する SocketAddress

戻り値

指定したソケット アドレスを使用する EndPoint インスタンス。

例外

例外の種類 条件
ArgumentException socketAddress の AddressFamily は、現在のインスタンスの AddressFamily と同じではありません。

または

socketAddress.Size < 8。

使用例

[Visual Basic, C#, C++] 指定した SocketAddress を使用して、 IPEndPoint を作成する例を次に示します。

 
' 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()))

[C#] 
// 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());

[C++] 
// Recreate the connection endpoint from the serialized information.
IPEndPoint* endpoint = new IPEndPoint((__int64)0,0);
IPEndPoint* clonedIPEndPoint = dynamic_cast<IPEndPoint*> (endpoint->Create(socketAddress));
Console::WriteLine(S"clonedIPEndPoint: {0}", clonedIPEndPoint);

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

IPEndPoint クラス | IPEndPoint メンバ | System.Net 名前空間 | EndPoint | SocketAddress