UdpClientとは何? わかりやすく解説 Weblio辞書 (original) (raw)

UdpClient クラス

ユーザー データグラム プロトコル (UDP) ネットワーク サービス提供します

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

解説解説

使用例使用例

ポート 11000 上のホスト名 www.contoso.com使用して UdpClient 接続確立する例を次に示します2 つ別個のリモート ホスト コンピュータ小さな文字列メッセージ送信されます。Receive メソッドメッセージ受信するまで実行ブロックします。**Receive** に渡されIPEndPoint使用して応答するホストID明らかになります

// With this constructor the local port number is arbitrarily assigned. UdpClient^ udpClient = gcnew UdpClient; try { udpClient->Connect( "host.contoso.com", 11000 );

// Send message to the host to which you have connected. array<Byte>^sendBytes = Encoding::ASCII->GetBytes( "Is anybody there?" ); udpClient->Send( sendBytes, sendBytes->Length );

// Send message to a different host using optional hostname and port parameters. UdpClient^ udpClientB = gcnew UdpClient; udpClientB->Send( sendBytes, sendBytes->Length, "AlternateHostMachineName", 11000 );

//IPEndPoint object will allow us to read datagrams sent from any source. IPEndPoint^ RemoteIpEndPoint = gcnew IPEndPoint( IPAddress::Any,0 );

// Block until a message returns on this socket from a remote host. array<Byte>^receiveBytes = udpClient->Receive( RemoteIpEndPoint ); String^ returnData = Encoding::ASCII->GetString( receiveBytes );

// Use the IPEndPoint object to determine which of these two hosts responded. Console::WriteLine( String::Concat( "This is the message you received ", returnData->ToString() ) ); Console::WriteLine( String::Concat( "This message was sent from ", RemoteIpEndPoint->Address->ToString(), " on their port number ", RemoteIpEndPoint->Port.ToString() ) ); udpClient->Close(); udpClientB->Close(); } catch ( Exception^ e ) { Console::WriteLine( e->ToString() ); }

.NET Framework のセキュリティ.NET Frameworkセキュリティ

継承階層継承階層

System.Object
System.Net.Sockets.UdpClient

スレッド セーフスレッド セーフ

プラットフォームプラットフォーム

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 によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

参照参照


UdpClient コンストラクタ ()

UdpClient クラス新しインスタンス初期化します。

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

例外例外

解説解説

使用例使用例

プラットフォームプラットフォーム

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 によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

参照参照


UdpClient コンストラクタ (Int32, AddressFamily)

UdpClient クラス新しインスタンス初期化し指定したローカル ポート番号バインドます。

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

例外例外

解説解説

使用例使用例

プラットフォームプラットフォーム

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 によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

参照参照


UdpClient コンストラクタ (Int32)

UdpClient クラス新しインスタンス初期化し指定したローカル ポート番号バインドます。

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

例外例外

解説解説

使用例使用例

プラットフォームプラットフォーム

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 によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

参照参照


UdpClient コンストラクタ (String, Int32)

UdpClient クラス新しインスタンス初期化し既定リモート ホスト確立します。

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

例外例外

解説解説

使用例使用例

プラットフォームプラットフォーム

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 によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

参照参照


UdpClient コンストラクタ (AddressFamily)

UdpClient クラス新しインスタンス初期化します。

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

例外例外

解説解説

プラットフォームプラットフォーム

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 によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

参照参照


UdpClient コンストラクタ (IPEndPoint)

UdpClient クラス新しインスタンス初期化し指定したローカル エンドポイントバインドます。

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

例外例外

解説解説

使用例使用例

プラットフォームプラットフォーム

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 によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

参照参照


UdpClient コンストラクタ


UdpClient プロパティ


UdpClient メソッド


UdpClient メンバ