UdpAnySourceMulticastClient.BeginSendTo 方法

定義

警告

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

開始將單點傳播封包傳送至指定目的地的作業。

public:
 IAsyncResult ^ BeginSendTo(cli::array <System::Byte> ^ buffer, int offset, int count, System::Net::IPEndPoint ^ remoteEndPoint, 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 BeginSendTo (byte[] buffer, int offset, int count, System.Net.IPEndPoint remoteEndPoint, 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.BeginSendTo : byte[] * int * int * System.Net.IPEndPoint * AsyncCallback * obj -> IAsyncResult
Public Function BeginSendTo (buffer As Byte(), offset As Integer, count As Integer, remoteEndPoint As IPEndPoint, callback As AsyncCallback, state As Object) As IAsyncResult

參數

buffer
Byte[]

包含要傳送之資料的緩衝區。

offset
Int32

buffer 開頭到讀取要傳送之資料的位移 (以位元組為單位)。

count
Int32

要從 buffer 傳送的位元組數目。

remoteEndPoint
IPEndPoint

要將封包傳送至其中的遠端端點。

callback
AsyncCallback

作業完成時要叫用的回呼方法。

state
Object

要傳遞給這項作業之 callback 方法的選擇性狀態資訊。

傳回

參考這項作業的 IAsyncResult

屬性

例外狀況

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

offset 小於 0

-或-

offset 大於 buffer 的長度。

-或-

count 小於 0

-或-

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

尚未聯結多點傳送群組。

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

備註

方法 BeginSendTo 會開始將 UDP 封包傳送至已加入多播群組的作業。

客戶端必須已完成多播群組的聯結。 參數中指定的 remoteEndPoint 目的地地址必須已經將多播封包傳送給這個接收者。 某些通訊協定會使用此資訊來傳遞流程控制、服務品質統計數據或復原訊息。

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

只有在 參數中指定的 remoteEndPoint 位址已經將多播封包傳送給這個接收者時,才允許傳輸。 如果不允許用戶端存取, SocketException 則會使用 AccessDenied擲回 。

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

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

適用於