UdpSingleSourceMulticastClient.BeginSendToSource Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Begins the operation of sending a unicast packet to the source previously specified.
Namespace: System.Net.Sockets
Assembly: System.Net (in System.Net.dll)
Syntax
'Declaration
<SecuritySafeCriticalAttribute> _
Public Function BeginSendToSource ( _
buffer As Byte(), _
offset As Integer, _
count As Integer, _
remotePort As Integer, _
callback As AsyncCallback, _
state As Object _
) As IAsyncResult
[SecuritySafeCriticalAttribute]
public IAsyncResult BeginSendToSource(
byte[] buffer,
int offset,
int count,
int remotePort,
AsyncCallback callback,
Object state
)
Parameters
- buffer
Type: array<System.Byte[]
The buffer that contains the data to send.
- offset
Type: System.Int32
The offset, in bytes, from the beginning of the buffer to read the data to be sent.
- count
Type: System.Int32
The number of bytes to send from the buffer.
- remotePort
Type: System.Int32
The remote port to which the packet is to be sent. The remote address is specified by the UdpSingleSourceMulticastClient constructor.
- callback
Type: System.AsyncCallback
The callback method to invoke when the operation completes.
- state
Type: System.Object
Optional state information to pass to the callback method for this operation.
Return Value
Type: System.IAsyncResult
An IAsyncResult that references this operation.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | buffer is nulla null reference (Nothing in Visual Basic). |
ArgumentOutOfRangeException | offset is less than 0 -or- offset is greater than the length of the buffer. -or- count is less than 0 -or- offset plus the count is greater than the length of the buffer. remotePort is less than 0 -or- remotePort is greater than 65,535. |
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 for sending. See the Remarks section for more information. |
Remarks
The BeginSendToSource method begins an operation of sending a UDP packet to the source previously specified.
Some protocols use this information to pass along flow control, quality of service statistics, or recovery messages.
The method specified in the callback parameter is invoked when a packet has been sent.
The client must have completed a join to the multicast group.
If the destination port specified in the remotePort parameter is less than 1,024, a SocketException is thrown with SocketError.AccessDenied.
It is possible to have a socket failure if a send operation fails synchronously, although this is uncommon with UDP. If a socket failure occurs, 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.