IPEndPoint コンストラクタ (Int64, Int32)
アセンブリ: System (system.dll 内)



指定した 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 );

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


IPEndPoint コンストラクタ (IPAddress, Int32)
アセンブリ: System (system.dll 内)



' 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; } }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


IPEndPoint コンストラクタ
Weblioに収録されているすべての辞書からIPEndPoint コンストラクタを検索する場合は、下記のリンクをクリックしてください。

- IPEndPoint コンストラクタのページへのリンク