Example #1
0
 private void ConnectCallback(IAsyncResult ar)
 {
     if (_closed)
     {
         return;
     }
     try
     {
         _remote.EndConnect(ar);
         _remote.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);
         HandshakeReceive();
     }
     catch (Exception e)
     {
         Logging.LogUsefulException(e);
         Close();
     }
 }
        private void ConnectCallback(IAsyncResult ar)
        {
            var state = (Socks5State)ar.AsyncState;

            try
            {
                _remote.EndConnect(ar);

                _remote.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);

                byte[] handshake = { 5, 1, 0 };
                _remote.BeginSend(handshake, 0, handshake.Length, 0, Socks5HandshakeSendCallback, state);
            }
            catch (Exception ex)
            {
                state.ex = ex;
                state.Callback?.Invoke(new FakeAsyncResult(ar, state));
            }
        }
Example #3
0
 public void EndConnectProxy(IAsyncResult asyncResult)
 {
     _remote.EndConnect(asyncResult);
     _remote.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);
 }