UdpSingleSourceMulticastClient.BeginSendToSource 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
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 是空參考(Visual Basic 中無任何參考)。
offset 小於 0
-或-
offset 大於 的 buffer長度。
-或-
count 小於 0
-或-
offset 加上計數大於 的 buffer長度。
-或-
remotePort 小於0或大於65,535。
多播團隊尚未加入。
嘗試存取該套接字時發生錯誤。
備註
此 BeginSendToSource 方法開始將 UDP 封包傳送至先前指定的來源。
有些協定會利用這些資訊傳遞流量控制、服務品質統計或恢復訊息。
參數中 callback 指定的方法是在封包傳送時被呼叫。
用戶端必須完成與多播群組的連接。
若參數中 remotePort 指定的目的埠小於 1,024,則拋出 a SocketException 與 AccessDenied。
如果傳送操作同步失敗,可能會導致套接字故障,雖然這在 UDP 中較為罕見。 若插座故障,會拋出 a SocketException 。 接收到的錯誤會被指定為列舉的成員 SocketError 。