Example #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            int    port  = Convert.ToInt32(textBox2.Text);
            string ip    = null;
            int    rport = Convert.ToInt32(null);
            arg    a     = new arg(ip, port, rport);
            Thread th    = new Thread(new ParameterizedThreadStart(ReadRequest));

            th.IsBackground = true;
            th.Start(a);
            //ReadRequest(a);
        }
Example #2
0
        private void ReadRequest(object ax)
        {
            arg         a      = (arg)ax;
            TcpListener server = new TcpListener(IPAddress.Any, a.port);

            server.Start();
            while (true)
            {
                TcpClient client = server.AcceptTcpClient();
                Thread    nt     = new Thread(DoProxy);
                nt.IsBackground = true;
                nt.Start(client);
                //DoProxy(client);
            }
        }