UdpSingleSourceMulticastClient.BeginSendToSource 方法

定义

注意

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

开始执行向之前指定的源发送单播数据包的操作。

public:
 IAsyncResult ^ BeginSendToSource(cli::array <System::Byte> ^ buffer, int offset, int count, int remotePort, AsyncCallback ^ callback, System::Object ^ state);
[System.Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]
public IAsyncResult BeginSendToSource (byte[] buffer, int offset, int count, int remotePort, AsyncCallback callback, object state);
[<System.Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)>]
member this.BeginSendToSource : byte[] * int * int * int * AsyncCallback * obj -> IAsyncResult
Public Function BeginSendToSource (buffer As Byte(), offset As Integer, count As Integer, remotePort As Integer, callback As AsyncCallback, state As Object) As IAsyncResult

参数

buffer
Byte[]

包含要发送的数据的缓冲区。

offset
Int32

要从中读取待发送数据的从 buffer 开始处的偏移量(以字节为单位)。

count
Int32

要从 buffer 发送的字节数。

remotePort
Int32

要向其发送数据包的远程端口。 远程地址由 UdpSingleSourceMulticastClient(IPAddress, IPAddress, Int32) 构造函数指定。

callback
AsyncCallback

要在此操作完成时调用的回调方法。

state
Object

要为此操作传递给 callback 方法的可选状态信息。

返回

IAsyncResult

引用此操作的 IAsyncResult

属性

例外

buffer 为 null 引用(在 Visual Basic 中为 Nothing)。

offset 小于 0

  • 或 - offset 大于 buffer 的长度。

  • 或 - count 小于 0

  • 或 - offset 加上此计数大于 buffer 的长度。

  • 或 - remotePort 小于 0 或大于 65,535。

尚未联接多播组。

尝试访问套接字时出错。

注解

BeginSendToSource方法开始向之前指定的源发送 UDP 数据包的操作。

某些协议使用此信息传递流控制、服务统计信息或恢复消息。

发送数据包时,将调用参数中指定的方法 callback

客户端必须已完成到多播组的联接。

如果参数中指定的目标端口 remotePort 小于1024, SocketException 则会引发 AccessDenied

如果发送操作同步失败,则可能会出现套接字故障,但这种情况并不常见。 如果出现套接字故障, SocketException 则会引发。 收到的错误被指定为枚举的成员 SocketError

适用于