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

屬性

例外狀況

buffer 是 null 參考 (在 Visual Basic 中為 Nothing)。

offset 小於 0

-或-

offset 大於 buffer 的長度。

-或-

count 小於 0

-或-

offset 加上這個計數會大於 buffer 的長度。

-或-

remotePort 小於 0 或大於 65,535。

尚未聯結多點傳送群組。

嘗試存取通訊端時發生錯誤。

備註

方法 BeginSendToSource 會開始將 UDP 封包傳送至先前指定的來源作業。

某些通訊協定會使用此資訊來傳遞流程控制、服務品質統計數據或復原訊息。

傳送封包時,會叫用 參數中指定的 callback 方法。

客戶端必須已完成多播群組的聯結。

如果 參數指定的 remotePort 目的地連接埠小於 1,024, SocketException 則會使用 AccessDenied擲回 。

如果傳送作業同步失敗,可能會發生套接字失敗,但 UDP 並不常見。 如果發生套接字失敗, SocketException 則會擲回 。 收到的錯誤會指定為 列舉的成員 SocketError

適用於