Click here to Skip to main content
15,891,841 members
Articles / Programming Languages / C++

HTTP Tunneling

Rate me:
Please Sign up or sign in to vote.
4.73/5 (38 votes)
14 Jun 2000 464.3K   17K   128  
This article describes how to open arbitrary TCP connections through proxy servers

/************************************
  REVISION LOG ENTRY
  Revision By: Alex Turc
  Revised on 6/15/00 6:34:39 PM
  Comments: Defines the entry point for the application
 ************************************/

#include "stdafx.h"
#include "common.h"
#include "manager.h"

#include <iostream>
#include <algorithm>
using namespace std;

#include "mylib/_socket.h"
#include "mylib/_init.h"
using namespace extension;


// Function name	: main
// Description	    : Main function
// Return type		: int 
// Argument         : int argc
// Argument         : char* argv[]
//int main(int argc, char* argv[])

int __stdcall WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, char* pCmdLine, int nCmdShow )
{
	
	/*
	// Parse cmd line
	list< string > lstParams = parse_cmd_line( argc, argv );

	bool bLog = ( find( lstParams.begin(), lstParams.end(), "-l" ) != lstParams.end() );
	*/

	// Create log file
	try
	{
		gpEventLog = new event_log( "HTTPTunneling.log", true );
	}
	catch( ... )
	{
		cerr << "Failed to create log file";
		return 0;
	}


	// Create the manager object
	try
	{				
		// Socket library initialization
		use_sockets _us( MAKEWORD(2,0) );

		// Create amanager object 
		a_ptr< manager > pManager = new manager();

		pManager->resume();

		MSG msg;
		while( ::GetMessage( &msg, 0, 0, 0 ) );

		pManager->stop();

	}
	catch( extended_exception e1 )
	{
		gpEventLog->log_event( event_log::event_type_error, e1.what() );
	}
	catch( exception e2 )
	{
		gpEventLog->log_event( event_log::event_type_error, e2.what() );
	}
	catch( ... )
	{
		gpEventLog->log_event( event_log::event_type_error, "Unknown error" );
	}

	// Delete log file
	delete gpEventLog;

	return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions