共用方式為


UdpSingleSourceMulticastClient.EndReceiveFromSource Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Completes the asynchronous operation of receiving a packet from the joined multicast group and provides the information received from a specified sender.

Namespace:  System.Net.Sockets
Assembly:  System.Net (in System.Net.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function EndReceiveFromSource ( _
    result As IAsyncResult, _
    <OutAttribute> ByRef sourcePort As Integer _
) As Integer
[SecuritySafeCriticalAttribute]
public int EndReceiveFromSource(
    IAsyncResult result,
    out int sourcePort
)

Parameters

  • sourcePort
    Type: System.Int32%
    The source port where the packet was received from.

Return Value

Type: System.Int32
The length, in bytes, of the message stored in the buffer parameter passed to the BeginReceiveFromSource method.

Exceptions

Exception Condition
ArgumentNullException

result is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

The multicast group has not yet been joined.

ObjectDisposedException

The UdpSingleSourceMulticastClient has been disposed.

SocketException

An error occurred when attempting to access the socket. See the Remarks section for more information.

Remarks

The EndReceiveFromSource method completes an asynchronous operation to receive a packet from a single source in a multicast group.

If there is a socket failure while performing the receive operation, a SocketException is thrown. The error received is specified as a member of the System.Net.Sockets.SocketError enumeration.

Version Information

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.