UdpAnySourceMulticastClient.BeginJoinGroup(AsyncCallback, Object) 方法

定義

警告

此 API 現已淘汰。

繫結此通訊端,並開始加入多點傳送群組的作業,接收來自任一群組參與者的資料包。Binds the socket and begins a join operation to the multicast group to allow datagrams to be received from any group participant.

public:
 IAsyncResult ^ BeginJoinGroup(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 BeginJoinGroup (AsyncCallback callback, object state);
member this.BeginJoinGroup : AsyncCallback * obj -> IAsyncResult
Public Function BeginJoinGroup (callback As AsyncCallback, state As Object) As IAsyncResult

參數

callback
AsyncCallback

作業完成時要叫用的回呼方法。A 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.

屬性

例外狀況

多點傳送群組已經加入,或加入作業目前正在進行中。The multicast group has already been joined or a join operation is currently in progress.

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

備註

方法BeginJoinGroup會將 UDP 多播通訊端系結至本機埠,並加入多播群組,以允許從任何多播群組參與者接收資料包。The BeginJoinGroup method binds a UDP multicast socket to a local port and joins a multicast group to allow datagrams to be received from any multicast group participant. 本機埠和多播群組位址是在此UdpAnySourceMulticastClient函式中指定。The local port and multicast group address are specified in the UdpAnySourceMulticastClient constructor.

當加入多播群組的callback作業完成時,會叫用參數中指定的方法。The method specified in the callback parameter is invoked when the operation to join the multicast group has completed.

如果執行時間需要,此BeginJoinGroup方法也會執行原則檢查,以確認允許用戶端存取多播群組。If required by the runtime, the BeginJoinGroup method also performs a policy check to verify that the client is allowed to access the multicast group. 如果不允許用戶端存取, SocketException則會AccessDenied擲回。If the client is not allowed access, a SocketException is thrown with AccessDenied.

適用於