EndDisconnect() public method

public EndDisconnect ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult
return void
Esempio n. 1
0
 public void DisconnectAsync(Action Action = null)
 {
     AsyncQueue.Add(() =>
     {
         try
         {
             NativeSocket.BeginDisconnect(true, (IAsyncResult) =>
             {
                 try
                 {
                     NativeSocket.EndDisconnect(IAsyncResult);
                     Core.EnqueueTask(() =>
                     {
                         if (Action != null)
                         {
                             Action();
                         }
                         AsyncQueue.Next();
                     });
                 }
                 catch (SocketException SocketException)
                 {
                     SocketExceptionThrown(SocketException);
                 }
             }, null);
         }
         catch (SocketException SocketException)
         {
             SocketExceptionThrown(SocketException);
         }
     });
 }
Esempio n. 2
0
 internal void DisconnectCallback(IAsyncResult ares)
 {
     try {
         curSocket.EndDisconnect(ares);
     } catch (SocketException ex) {
         SocketError = ex.SocketErrorCode;
     } finally {
         OnCompleted(this);
     }
 }
Esempio n. 3
0
 internal void DisconnectCallback(IAsyncResult ares)
 {
     try {
         curSocket.EndDisconnect(ares);
     } catch (SocketException ex) {
         SocketError = ex.SocketErrorCode;
     } catch (ObjectDisposedException) {
         SocketError = SocketError.OperationAborted;
     } finally {
         OnCompleted(this);
     }
 }
Esempio n. 4
0
        private void SocketDisconnectCallBack(IAsyncResult iar)
        {
            Socket socket = (Socket)iar.AsyncState;

            try
            {
                string remoteEndPoint = ((IPEndPoint)socket.RemoteEndPoint).ToString();
                socket.EndDisconnect(iar);
                OnDisconnected(new TcpEventArgs(socket));
                disconnectDone.Set();
            }
            catch (SocketException se)
            {
                ShowError(se);
            }
            finally
            {
                mre.Set();
            }
        }
Esempio n. 5
0
 void Utils.Wrappers.Interfaces.ISocket.EndDisconnect(System.IAsyncResult asyncResult)
 {
     InternalSocket.EndDisconnect(asyncResult);
 }
Esempio n. 6
0
        private void BeginDisconnection(IAsyncResult iar)
        {
            try
            {
                client = (Socket)iar.AsyncState;

                client.EndDisconnect(iar);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 7
0
 private static void OnDisonnect(IAsyncResult ar)
 {
     try
     {
         s_socket = (Socket)ar.AsyncState;
         s_socket.EndDisconnect(ar);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + " -> OnDisonnect", @"Chat: " + Client.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }