このトピックはまだ評価されていません - このトピックを評価する

DatagramSocketMessageReceivedEventArgs Class

DatagramSocketMessageReceived イベントに関するデータを提供します。

構文


public sealed class DatagramSocketMessageReceivedEventArgs : Object

属性

DualApiPartitionAttribute()
GCPressureAttribute()
MarshalingBehaviorAttribute(Agile)
VersionAttribute(NTDDI_WIN8)

メンバー

DatagramSocketMessageReceivedEventArgsクラス には次の種類のメンバーが含まれます:

メソッド

The DatagramSocketMessageReceivedEventArgs クラス には次のメソッドがあります。C#、Visual Basic、C++ では、次のもののメソッドも継承しますObject クラス.

メソッド説明
GetDataReader Gets a DataReader object to read incoming data received from the remote network destination on a DatagramSocket object.
GetDataStream Gets an IInputStream object that represents a sequential stream of bytes to be read as a message from the remote network destination on a DatagramSocket object.

 

プロパティ

DatagramSocketMessageReceivedEventArgsクラス次のプロパティがあります。

プロパティアクセスの種類説明

LocalAddress

読み取り専用Gets the local IP address associated with a DatagramSocket when a message was received.

RemoteAddress

読み取り専用Gets the IP address of the remote sender of the datagram on the DatagramSocket when a message is received.

RemotePort

読み取り専用Gets the UDP port number of the remote sender of the datagram received on the DatagramSocket.

 

注釈

DatagramSocketMessageReceivedEventArgs は、DatagramSocket オブジェクトでデータを受け取るために使用されます。

DatagramSocket.BindServiceNameAsync または DatagramSocket.BindEndpointAsync メソッドは、DatagramSocket インスタンスがデータを待機し、受信しようとする場合、ローカル サービス名または UDP ポートに DatagramSocket をバインドするために使用されます。DatagramSocket をデータ送信のみに使用する場合は、これらのメソッドは必要ありません。

メッセージの受信時にローカル サービス名または UDP ポートに束縛されている DatagramSocket で、DatagramSocket.MessageReceived イベントが発生します。DatagramSocketMessageReceivedEventArgs インスタンスは、DatagramSocket.MessageReceived イベントの発生時に作成されます。

メッセージを受信したときにデータを読み取るには、主に 2 種類の方法があります。

  • GetDataStream メソッドは、受信メッセージの順次バイト ストリームを表す Streams.IInputStream オブジェクトを返します。その後、アプリケーションは受信したバイト ストリームを解析する必要があります。
  • GetDataReader メソッドは、Streams.DataReader オブジェクトを返して、受信データを読み取ります。Streams.DataReader オブジェクトには、バイト、符号付き整数と符号なし整数、ブール値、単精度浮動小数点数と倍精度浮動小数点数、文字列、日時と期間値、GUID、バッファーを含むさまざまな形式のデータを読み取る個別の方法があります。 これらのメソッドは、受信したメッセージを解析するために直接使用できます。

要件

サポートされている最小のクライアント

Windows 8 [Windows ストア アプリ, デスクトップ アプリ]

サポートされている最小のサーバー

Windows Server 2012 [Windows ストア アプリ, デスクトップ アプリ]

サポートされている最小の電話

Windows Phone 8

名前空間

Windows.Networking.Sockets
Windows::Networking::Sockets [C++]

メタデータ

Windows.winmd

DLL

Windows.Networking.dll

Capabilities

ID_CAP_NETWORKING [Windows Phone]

参照

DatagramSocket
DatagramSocket.BindServiceNameAsync
DatagramSocket.BindEndpointAsync
DatagramSocket.MessageReceived
Streams.DataReader
Streams.IInputStream
Object

 

 

この情報は役に立ちましたか。
(残り 1500 文字)
© 2013 Microsoft. All rights reserved.