Example #1
0
        public static void DoRequest(SocksServer server, Socket client, TunnelConfig tunnelConfig)
        {
            SocksConnection connection = new SocksConnection(server, client, tunnelConfig);

            client.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1);
            ThreadPool.QueueUserWorkItem(new WaitCallback(connection.DoRequest));
        }
Example #2
0
        private void OnBeginAcceptSocket(IAsyncResult async)
        {
            TcpListener listener = async.AsyncState as TcpListener;

            try
            {
                Socket client = listener.EndAcceptSocket(async);
                SocksConnection.DoRequest(this, client, _TunnelConfig);
                if (this.IsStarted)
                {
                    listener.BeginAcceptSocket(this.OnBeginAcceptSocket, listener);
                }
            } catch (ObjectDisposedException)
            {
            } catch (Exception ex)
            {
                LogController.Error("Socks proxy server error: " + ex.Message);
            }
        }