UdpAnySourceMulticastClient.BeginSendToGroup(Byte[], Int32, Int32, AsyncCallback, Object) 方法

定義

警告

此 API 現已淘汰。

開始將封包傳送至已加入的多點傳送群組之作業,並在封包傳送至群組時,叫用指定的回呼。Begins the operation of sending a packet to a joined multicast group and invokes the specified callback when a packet has been sent to the group.

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

參數

buffer
Byte[]

包含要傳送之資料的緩衝區。The buffer that contains the data to send.

offset
Int32

buffer 開頭到讀取要傳送之資料的位移 (以位元組為單位)。The offset, in bytes, from the beginning of the buffer to read the data to be sent.

count
Int32

要從 buffer 傳送的位元組數目。The number of bytes to send from the buffer.

callback
AsyncCallback

作業完成時要叫用的回呼方法。The callback method to invoke when the operation completes.

state
Object

要傳遞給這項作業之 callback 方法的選擇性狀態資訊。Optional state information to pass to the callback method for this operation.

傳回

參考這項作業的 IAsyncResultAn IAsyncResult that references this operation.

屬性

例外狀況

buffer 是 null 參考 (在 Visual Basic 中為 Nothing)。buffer is a null reference (Nothing in Visual Basic).

offset 小於 0offset is less than 0 -或--or- offset 大於 buffer 的長度。offset is greater than the length of the buffer.

-或--or- count 小於 0count is less than 0 -或--or- offset 加上這個計數會大於 buffer 的長度。offset plus the count is greater than the length of the buffer.

尚未聯結多點傳送群組。The multicast group has not yet been joined.

嘗試存取通訊端時發生錯誤。An error occurred when attempting to access the socket.

備註

BeginSendToGroup方法會開始將 UDP 封包傳送至聯結的多播群組的作業。The BeginSendToGroup method begins an operation of sending a UDP packet to the joined multicast group.

用戶端必須已完成加入多播群組的作業。The client must have completed a join to the multicast group.

在收到封包時callback ,會叫用參數中指定的方法。The method specified in the callback parameter is invoked when a packet has received.

如果接收作業同步失敗,則可能會有通訊端失敗,雖然這在 UDP 中並不常見。It is possible to have a socket failure if a receive operation fails synchronously, although this is uncommon with UDP. 如果發生通訊端失敗, SocketException則會擲回。If a socket failure occurs, a SocketException is thrown. 收到的錯誤會指定為SocketError列舉的成員。The error received is specified as a member of the SocketError enumeration.

適用於