/** * 异步结束发送 */ public int EndSend(IAsyncResult iar) { DelegateForSend delSend = (iar as AsyncResult).AsyncDelegate as DelegateForSend; int result = -1; try { result = delSend.EndInvoke(iar); } catch (Exception ex) { Debug.LogError(ex); } return(result); }
/** * 异步开始发送 */ public IAsyncResult BeginSend(byte[] bytes, Int32 length, AsyncCallback callback, System.Object state) { DelegateForSend delSend = new DelegateForSend(Send); return(delSend.BeginInvoke(bytes, length, callback, state)); }