Click here to Skip to main content
Click here to Skip to main content

Internet Magic (Proxy Server) Windows Application

, 10 Apr 2010
Rate this:
Please Sign up or sign in to vote.
Windows application which creates a proxy server to share Internet over any TCP/IP network

Project code

Class architecture

1.jpg

Introduction

In any network, each system has a unique IP address which identifies the system in the network. This application aims at distributing the internet over a network, based on the IP address. Administrator registers the IP addresses of the client in the application (proxy server), which then allows access to the various services provided by the server on the systems identified by these IP addresses.

This project is being developed using C# .NET in Visual Studio 2005.

Feature Set

  • IP address based internet sharing
  • Network monitoring to monitor online client activity
  • Web filter which can be used to block specified web sites
  • Time scheduling to limit client’s on-line time
  • Bandwidth usage statistics to monitor the bandwidth
  • Account authentication for Socks protocol
  • Socks support allows various internet messengers and FTP downloaders
  • Portmap maps a port on a specific IP address to another port on another IP address
  • This application also supports HTTP/FTP

Background

In computer networks, a proxy server is a server (a computer system or an application program) that services the requests of its clients by forwarding requests to other servers. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource, available from a different server. The proxy server provides the resource by connecting to the specified server and requesting the service on behalf of the client. A proxy server may optionally alter the client's request or the server's response, and sometimes it may serve the request without contacting the specified server. In this case, it would 'cache' the first request to the remote server, so it could save the information for later, and make everything as fast as possible. A proxy server that passes all requests and replies unmodified is usually called a gateway or sometimes tunnelling proxy. A proxy server can be placed in the user's local computer or at various points between the user and the destination servers or the Internet.

Using the Code

This application created using VS2005 code can directly open in Visual Studio using its Solution file.

The language used is C# using .NET 2.0, executable file will be created on program execution.

    //SAMPLE OF THE CODE
    int Ret;
    try  {
		Ret = ClientSocket.EndReceive(ar);
	} catch {
		Ret = -1;
	}
	if (Ret <= 0) { //Connection is dead :(
		Dispose();
		return;
	}
	HttpQuery += Encoding.ASCII.GetString(Buffer, 0, Ret);
    /******************For Authentication************************/
    HeaderFields = ParseQuery(HttpQuery);
    if (HeaderFields == null || !HeaderFields.ContainsKey("Host"))
    {
        SendBadRequest();
        return;
    }
    int Port;
    string Host;
        
    if (HttpRequestType.ToUpper().Equals("CONNECT"))
    { //HTTPS
        Ret = RequestedPath.IndexOf(":");
        if (Ret >= 0)
        {
            Host = RequestedPath.Substring(0, Ret);
            if (RequestedPath.Length > Ret + 1)
                Port = int.Parse(RequestedPath.Substring(Ret + 1));
            else
                Port = 443;
        }
        else
        {
            Host = RequestedPath;
            Port = 443;
        }
    }
    else
    { //Normal HTTP
        Ret = ((string)HeaderFields["Host"]).IndexOf(":");
        if (Ret > 0)
        {
            Host = ((string)HeaderFields["Host"]).Substring(0, Ret);
            Port = int.Parse(((string)HeaderFields["Host"]).Substring(Ret + 1));
        }
        else
        {
            Host = (string)HeaderFields["Host"];
            Port = 80;
        }
        if (HttpRequestType.ToUpper().Equals("POST"))
        {
            int index = HttpQuery.IndexOf("\r\n\r\n");
            m_HttpPost = HttpQuery.Substring(index + 4);
        }
    }
    string dir = Environment.CurrentDirectory;
    if (!dir.Substring(dir.Length - 1, 1).Equals(@"\"))
        dir += @"\";
    Program prx = Program.obj;

    //

Points of Interest

The product is a very low cost system with a Windows application, where a system in which application is installed has a purpose to provide web services over the connected network. The administrator controlling this server has to give details of the client about their authorization to access these services and until when they can access it. The system then automatically generates a request window on client requesting access to the services which, if registered by administrator of server, then client can fully utilize the services provided by serve. Then system automatically controls the access time and monitors the client for their activity in the internet. After the validity period of the client has expired, then the client will be automatically barred from accessing these services.

History

  • 10th April, 2010: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

shi123456

India India
No Biography provided

Comments and Discussions

 
QuestionERROR Pinmemberosmo3323-Feb-14 20:59 
QuestionUser authentication Pinmembernitin-aem25-Apr-13 23:39 
Hi,
 
I want to add a new module into this app i.e. user is provided with username and password.
Whenever the user tries to access any webpage he/she should be prompted with a webpage asking fr username and password . If he/she provides both correctly then only he/she should be registered and allowed to access internet.
 
Can you please guide me for this.
GeneralMy vote of 1 PinmemberSyed Javed16-Dec-11 6:44 
QuestionWorks with proxy checkers? Pinmemberjp7315-Aug-11 12:34 
GeneralMy vote of 1 PinmemberMChris200611-May-11 8:43 
GeneralMy vote of 1 Pinmemberaldycool6-Jan-11 4:34 
GeneralRe: My vote of 1 Pinmembershi1234565-Mar-11 5:08 
GeneralRe: My vote of 1 PinmemberChris G.4-Aug-13 23:32 
QuestionMentalis? Pinmemberaldycool6-Jan-11 4:32 
GeneralMy vote of 1 PinmemberSyed Javed7-Aug-10 18:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140902.1 | Last Updated 10 Apr 2010
Article Copyright 2010 by shi123456
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid