IPEndPoint コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IPEndPoint コンストラクタの意味・解説 

IPEndPoint コンストラクタ (Int64, Int32)

指定したアドレスポート番号使用して、IPEndPoint クラス新しインスタンス初期化します。

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

例外例外
例外種類条件

ArgumentOutOfRangeException

port が MinPort より小さい。

または

port が MaxPort より大きい

または

address が 0 未満か、0x00000000FFFFFFFF よりも大きい値です。

使用例使用例

指定した IP アドレスポート番号使用して IPEndPoint作成する例を次に示します

Dim hostIPAddress1 As IPAddress = Dns.Resolve(hostString1).AddressList(0)
Dim hostIPEndPoint As New
 IPEndPoint(hostIPAddress1, 80)
Console.WriteLine((ControlChars.Cr + "IPEndPoint information:"
 + hostIPEndPoint.ToString()))
Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Maximum
 allowed Port Address :" + IPEndPoint.MaxPort.ToString()))
Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Minimum
 allowed Port Address :" + IPEndPoint.MinPort.ToString()))
Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Address
 Family :" + hostIPEndPoint.AddressFamily.ToString()))
        

IPAddress hostIPAddress1 = (Dns.Resolve(hostString1)).AddressList[0];
Console.WriteLine(hostIPAddress1.ToString());
IPEndPoint hostIPEndPoint = new IPEndPoint(hostIPAddress1,80);
Console.WriteLine("\nIPEndPoint information:" + hostIPEndPoint.ToString());
Console.WriteLine("\n\tMaximum allowed Port Address :" + IPEndPoint.MaxPort);
Console.WriteLine("\n\tMinimum allowed Port Address :" + IPEndPoint.MinPort);
Console.WriteLine("\n\tAddress Family :" + hostIPEndPoint.AddressFamily);
IPAddress^ hostIPAddress1 = (Dns::Resolve( hostString1 ))->AddressList[ 0 ];
Console::WriteLine( hostIPAddress1 );
IPEndPoint^ hostIPEndPoint = gcnew IPEndPoint( hostIPAddress1,80 );
Console::WriteLine( "\nIPEndPoint information:{0}", hostIPEndPoint );
Console::WriteLine( "\n\tMaximum allowed Port Address :{0}", IPEndPoint::MaxPort
 );
Console::WriteLine( "\n\tMinimum allowed Port Address :{0}", (int^)IPEndPoint::MinPort
 );
Console::WriteLine( "\n\tAddress Family :{0}", hostIPEndPoint->AddressFamily
 );
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

IPEndPoint コンストラクタ (IPAddress, Int32)

指定したアドレスポート番号使用して、IPEndPoint クラス新しインスタンス初期化します。

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

例外例外
例外種類条件

ArgumentOutOfRangeException

port が MinPort より小さい。

または

port が MaxPort より大きい

または

address が 0 未満か、0x00000000FFFFFFFF よりも大きい値です。

使用例使用例
' Obtain the IP address from the list of IP addresses associated with
 the server.
Dim address As IPAddress
For Each address In host.AddressList
  Dim endpoint As New IPEndPoint(address,
 port)


  tempSocket = New Socket(endpoint.AddressFamily, SocketType.Stream,
 ProtocolType.Tcp)

  tempSocket.Connect(endpoint)

  If tempSocket.Connected Then
    ' Display the endpoint information.
    displayEndpointInfo(endpoint)
    ' Serialize the endpoint to obtain a SocketAddress object.
    serializedSocketAddress = serializeEndpoint(endpoint)
    Exit For

  End If

Next address

// Obtain the IP address from the list of IP addresses associated with
 the server.
foreach(IPAddress address in host.AddressList)
{
  IPEndPoint endpoint = new IPEndPoint(address, port);

    
  tempSocket = 
    new Socket(endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

  tempSocket.Connect(endpoint);

  if(tempSocket.Connected)
  {
    // Display the endpoint information.
    displayEndpointInfo(endpoint);
    // Serialize the endpoint to obtain a SocketAddress object.
    serializedSocketAddress = serializeEndpoint(endpoint);
    break;
  }
  else
    continue;
}
// Obtain the IP address from the list of IP addresses associated with
 the server.
System::Collections::IEnumerator^ myEnum = host->AddressList->GetEnumerator();
while ( myEnum->MoveNext() )
{
   IPAddress^ address = safe_cast<IPAddress^>(myEnum->Current);
   IPEndPoint^ endpoint = gcnew IPEndPoint( address,port );
   tempSocket = gcnew Socket( endpoint->AddressFamily,SocketType::Stream,ProtocolType::Tcp
 );
   tempSocket->Connect( endpoint );
   if ( tempSocket->Connected )
   {
      // Display the endpoint information.
      displayEndpointInfo( endpoint );

      // Serialize the endpoint to obtain a SocketAddress object.
      serializedSocketAddress = serializeEndpoint( endpoint );
      break;
   }
   else
            continue;
}
// Obtain the IP address from the list of IP addresses 
// associated with the server.
for (int iCtr = 0; iCtr < host.get_AddressList().length;
 iCtr++) {
    IPAddress address = host.get_AddressList()[iCtr];
    IPEndPoint endpoint = new IPEndPoint(address, port);
    tempSocket = new Socket(endpoint.get_AddressFamily(), 
        SocketType.Stream, ProtocolType.Tcp);
    tempSocket.Connect(endpoint);
    if (tempSocket.get_Connected()) {
        // Display the endpoint information.
        DisplayEndpointInfo(endpoint);
        // Serialize the endpoint to obtain a SocketAddress object.
        serializedSocketAddress = SerializeEndpoint(endpoint);
        break;    
    }
    else {
        continue;
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

IPEndPoint コンストラクタ



このページでは「.NET Framework クラス ライブラリ リファレンス」からIPEndPoint コンストラクタを検索した結果を表示しています。
Weblioに収録されているすべての辞書からIPEndPoint コンストラクタを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からIPEndPoint コンストラクタ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「IPEndPoint コンストラクタ」の関連用語

IPEndPoint コンストラクタのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IPEndPoint コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS