A Simple Http Proxy Server

Environment: Visual C++ 6.0

This proxy program is a very simple console application to implement the HTTP proxy. It donot contain so much error tolerant code, so it is short. Run the proxy program, set your internet browser proxy server with correct ip and its port is 5060(default, defined in program as PROXYPORT), it should be work( I test it with IE4.0 and on Win98). Press 'q' will terminate the proxy program.

The program's structure is simple. For each request , it starts two threads, one is forward local data to remote server and the other is forward remote data to local machine.

Function UserToProxyThread(void *pParam) is to forward local data to remote server. It can be considered as server thread , when local request comes, it fork itself and read the coming data, then start another thread(ProxyToServer()) which connect to remote server. After remote server is connected, it read data from local machine and send it to remote machine. Meanwhile thread ProxyToServer , which can be considered as client, forward the remote server data to local machine.

Download source - 7KB



Comments

  • proxy server using multithreading

    Posted by appleapplemanthra12345 on 07/06/2010 12:45pm

    hello i want the proxy server program using multithreads...can any one help me how to write the code for my project(networking proggram)

    Reply
  • Connectingto internet problem

    Posted by nwadmin on 02/24/2005 11:02pm

    In my browser(IE)at client,when i type "www.google.com",I received this error : "...... Ifrom client Client connection to : www.google.akadns.net connect() failed:10060" How can i solve this problem.

    Reply
  • Reason why some sites do not work

    Posted by Legacy on 02/10/2004 12:00am

    Originally posted by: Derek

    Basically the gethostbyname is failing... just add the host/ip to your /etc/hosts for unix, or system32/drivers/etc/hosts for windoz.

    Cheers,
    Derek

    Reply
  • to use only with http/1.0

    Posted by Legacy on 11/14/2003 12:00am

    Originally posted by: Eduard

    this program like the http 1.0 connections, setting up your browsers. thank you!

    Reply
  • How to run this program?

    Posted by Legacy on 09/21/2003 12:00am

    Originally posted by: Wei Chen

    I complied the sourcecode with MS Visual 6 without any problem.

    Can someone tell me how to run this program? I mean should I do any setups?

    Reply
  • Problem with remote server to proxy

    Posted by Legacy on 02/21/2003 12:00am

    Originally posted by: Ujjal

    It worked fine with client( webbrowser) to proxy. Also worked fine with proxy to remote server( for eg. www.msn.com), I can see proxy receiving bytes from client, but when proxy tries to make connecton with remote server, it connects but it fails on recv() function. Does anyone know what is the problem with that? i think it uses port 80 every time it tries connection with remote server, is that a problem?

    • Why didn't anyone answer this question?????

      Posted by nwadmin on 03/06/2005 11:19pm

      I had also this fault : "It worked fine with client( webbrowser) to proxy. Also worked fine with proxy to remote server( for eg. www.msn.com), I can see proxy receiving bytes from client, but when proxy tries to make connecton with remote server, it connects but it fails on recv() function. Does anyone know what is the problem with that? i think it uses port 80 every time it tries connection with remote server, is that a problem?

      Reply
    • Connect to Internet: the problem

      Posted by nwadmin on 02/24/2005 11:00pm

      In my browser(IE)at client,when i type "www.google.com",I received this error : "...... Ifrom client Client connection to : www.google.akadns.net connect() failed:10060" How can i solve this problem.

      Reply
    Reply
  • Free Proxy Server Like this for Win2k

    Posted by Legacy on 10/02/2002 12:00am

    Originally posted by: AJ

    This software doesn't work very well in Win2k. I'm looking for something like this, but with the source code and it must work on Win2k, any suggestions?

    Thanks!

    Reply
  • doesn't work

    Posted by Legacy on 09/21/2002 12:00am

    Originally posted by: abdou

    i tried to execute the program but i got like 18 errors and i do not know to handle that.could you please help me with it?
    

    Reply
  • How to interface ASP engine with a newly developed HTTP server

    Posted by Legacy on 07/25/2002 12:00am

    Originally posted by: sorry


    could u plz describe how to pass request for an .asp files to ASP engine from a newly developed HTTP server

    Reply
  • can't execute

    Posted by Legacy on 06/23/2002 12:00am

    Originally posted by: gwyn

    I was getting numerous error messages.
    -------------------Configuration: Proxy - Win32 Debug--------------------
    Linking...
    Proxy.obj : error LNK2001: unresolved external symbol __imp__listen@8
    Proxy.obj : error LNK2001: unresolved external symbol __imp__bind@12
    Proxy.obj : error LNK2001: unresolved external symbol __imp__socket@12
    Proxy.obj : error LNK2001: unresolved external symbol __imp__htons@4
    Proxy.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
    Proxy.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
    Proxy.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
    Proxy.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
    Proxy.obj : error LNK2001: unresolved external symbol __imp__send@16
    Proxy.obj : error LNK2001: unresolved external symbol __imp__recv@16
    Proxy.obj : error LNK2001: unresolved external symbol __imp__accept@12
    Proxy.obj : error LNK2001: unresolved external symbol __imp__connect@12
    Proxy.obj : error LNK2001: unresolved external symbol __imp__gethostbyaddr@12
    Proxy.obj : error LNK2001: unresolved external symbol __imp__inet_addr@4
    Proxy.obj : error LNK2001: unresolved external symbol __imp__gethostbyname@4
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
    Debug/Proxy.exe : fatal error LNK1120: 17 unresolved externals
    Error executing link.exe.

    Proxy.exe - 18 error(s), 0 warning(s)

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Packaged application development teams frequently operate with limited testing environments due to time and labor constraints. By virtualizing the entire application stack, packaged application development teams can deliver business results faster, at higher quality, and with lower risk.

  • Do you know where your data is? Consumer cloud-based file sharing services store your sensitive company data on servers outside of your control, outside of your policy and regulatory guidelines – maybe even outside your country – and not managed by you. The potential for data leakage, security breaches, and harm to your business is enormous. Download this white paper to learn about file sync and share alternatives that allow you to manage and protect your sensitive data while integrating and …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds