コード例 #1
0
 protected void CloseClientSocket(SocketAsyncEventArgs e)
 {
     Close(() =>
     {
         if (e.SocketError == SocketError.ConnectionReset)
         {
             if (this is GameClient)
             {
                 ServerShutDown?.Invoke(this, e);
                 Console.WriteLine("服务器主动断开");
             }
             else
             {
                 Console.WriteLine("客户端异常断开");
             }
         }
         if (e.SocketError == SocketError.ConnectionAborted)
         {
             Console.WriteLine("网络断开");
             ClientInternetError?.Invoke(this, e);
         }
         if (e.SocketError == SocketError.Success)
         {
             Console.WriteLine("客户端正常断开");
         }
         DisconnectCompleted?.Invoke(this, e);
     });
 }
コード例 #2
0
ファイル: OpcHelper.cs プロジェクト: lxy-coding/LIMS.DC
 /// <summary>
 /// 服务器停止工作
 /// </summary>
 /// <param name="reason"></param>
 private static void OpcService_ServerShutDown(string reason)
 {
     ServerShutDown?.Invoke(reason);
 }
コード例 #3
0
 /// <summary>
 /// 服务器停止工作
 /// </summary>
 /// <param name="szReason"></param>
 public void ShutdownRequest(string szReason)
 {
     ServerShutDown?.BeginInvoke(szReason, null, null);
 }