/// <summary> /// 触发网络错误事件 /// </summary> /// <param name="state"></param> private void RaiseNetError(AsyncUDPState state) { if (NetError != null) { NetError(this, new AsyncUDPEventArgs(state)); } }
/// <summary> /// 触发异常事件 /// </summary> /// <param name="state"></param> private void RaiseOtherException(AsyncUDPState state, string descrip) { if (OtherException != null) { OtherException(this, new AsyncUDPEventArgs(descrip, state)); } }
/// <summary> /// 触发数据发送完毕的事件 /// </summary> /// <param name="state"></param> private void RaiseCompletedSend(AsyncUDPState state) { if (CompletedSend != null) { CompletedSend(this, new AsyncUDPEventArgs(state)); } }
/// <summary> /// 触发发送数据前的事件 /// </summary> /// <param name="state"></param> private void RaisePrepareSend(AsyncUDPState state) { if (PrepareSend != null) { PrepareSend(this, new AsyncUDPEventArgs(state)); } }
private void RaiseDataReceived(AsyncUDPState state) { if (DataReceived != null) { DataReceived(this, new AsyncUDPEventArgs(state)); } }
/// <summary> /// 关闭一个与客户端之间的会话 /// </summary> /// <param name="state">需要关闭的客户端会话对象</param> public void Close(AsyncUDPState state) { if (state != null) { //_clients.Remove(state); //_clientCount--; //TODO 触发关闭事件 } }
private void RaiseOtherException(AsyncUDPState state) { RaiseOtherException(state, ""); }
public AsyncUDPEventArgs(string msg, AsyncUDPState state) { this._msg = msg; this._state = state; IsHandled = false; }
public AsyncUDPEventArgs(AsyncUDPState state) { this._state = state; IsHandled = false; }