Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 2.22 KB

datagramsocket_messagereceived.md

File metadata and controls

28 lines (19 loc) · 2.22 KB
-api-id -api-type
E:Windows.Networking.Sockets.DatagramSocket.MessageReceived
winrt event

Windows.Networking.Sockets.DatagramSocket.MessageReceived

-description

An event that indicates that a message was received on the DatagramSocket object.

-remarks

To receive data on the DatagramSocket object, an app must assign the [MessageReceived event to an event handler and then call either the BindEndpointAsync or BindServiceNameAsync method to bind the DatagramSocket to a local service name or UDP port. The ConnectAsync methods will also result in a bind operation. Writing to a stream returned by one of the GetOutputStreamAsync methods will also result in a bind operation. The MessageReceived event handler will be invoked whenever a message from a remote endpoint arrives.

To receive multicast packets on the DatagramSocket object, an app must assign the [MessageReceived event to an event handler and then call the JoinMulticastGroup method to join the multicast group.

To unregister the [MessageReceived event, the DatagramSocket object must be closed. The Close method is used by Windows app using JavaScript. For apps written using the .NET Framework 4.5 in C# and VB.NET, the Close method is exposed as the method on the DatagramSocket. For apps written in C++, the Close method will be called when using the delete keyword on the object.

-examples

-see-also

DatagramSocket sample (Windows 10)

-capabilities

ID_CAP_NETWORKING [Windows Phone]