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