語言

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 是空參考(Visual Basic 中無任何參考)。

offset 小於 0

-或-

offset 大於 的 buffer長度。

-或-

count 小於 0

-或-

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

多播團隊尚未加入。

這些 UdpAnySourceMulticastClient 已經被處理掉了。

嘗試存取該套接字時發生錯誤。

備註

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

用戶端必須完成與多播群組的連接。 參數中 remoteEndPoint 指定的目的地址必須已經向該接收端發送了多播封包。 有些協定會利用這些資訊傳遞流量控制、服務品質統計或恢復訊息。

參數中 callback 指定的方法是在封包收到時被呼叫。

只有當參數中指定的 remoteEndPoint 位址已經向該接收端傳送多播封包時,才允許傳輸。 若客戶端不被允許存取,則拋出 a SocketException 與 AccessDenied。

若參數中 remoteEndPoint 指定的目的埠小於 1,024,則拋出 a SocketException 與 AccessDenied。

如果接收操作同步失敗,可能會導致套接字故障,雖然這在 UDP 中較少見。 若插座故障,會拋出 a SocketException 。 接收到的錯誤會被指定為列舉的成員 SocketError 。

適用於