Exemplo n.º 1
0
 public static void CloseCurrent(this Socket socket)
 {
     if (socket != null)
     {
         ExceptionUtil.EatException(() => socket.Close(10000));
     }
 }
Exemplo n.º 2
0
 public static void ShutDownCurrent(this Socket socket)
 {
     if (socket != null)
     {
         ExceptionUtil.EatException(() => socket.Shutdown(SocketShutdown.Both));
         socket.CloseCurrent();
     }
 }
Exemplo n.º 3
0
 public static void DisposeCurrent(this SocketAsyncEventArgs e, EventHandler <SocketAsyncEventArgs> Completed)
 {
     if (e != null)
     {
         ExceptionUtil.EatException(() =>
         {
             e.Completed   -= Completed;
             e.AcceptSocket = null;
             e.Dispose();
         });
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 释放全部连接
 /// </summary>
 public static void DisposeConn()
 {
     lock (_connectionMultiplexerCache)
     {
         ExceptionUtil.EatException(() =>
         {
             foreach (var item in _connectionMultiplexerCache.Values)
             {
                 ExceptionUtil.EatException(() => item.Dispose());
             }
             _connectionMultiplexerCache.Clear();
         });
     }
 }