TcpCLient on Proxy

  • Thread starter Evan Freeman[C++ Samuri]
  • Start date
E

Evan Freeman[C++ Samuri]

Recently I found a question online that originated from this group, and
those who responded to it were of no help to the poster. So I am sorry that
I was not watching this group before, but will from now on and will offer my
help as follows to anser the original question.

****************************************************************************
*******************************************
hi,
I work on a computer that is part of a network and uses proxy to connect to
net. I cant connect to servers outside my proxy with simple ConnectTo code.
I need to know how to make my requests go through proxy. eg,
_socket = new TcpClient("http://msdn.microsoft.com";, port);
does not work.
Thanx.
Ab.
****************************************************************************
*******************************************

In order to use a prox with TcpClient you will need to pass the proxy server
and port to the TcpClient, like so:

TcpClient tc = new TcpClient(proxhost, proxport);

then you will have to pass your data on the stream.

Now I have only done this with HTTP so depending on what protocol you use
you will have to construct the message with the proper headers and wrappers
and the like.

eg., for HTTP something like this "GET http:wwww.microsoft.com/ http/1.0
\r\n Host: www.microsoft.com \n\n"

It will depend on what protocols your proxy supports. In my company we have
a proxy for HTTP FTP and Telnet.

Once you knw what protocol you will be using you can do the research from
there.

I hope someone finds this helpful. I will be publishing a full article on my
blog and on whatever publication wants to buy the article off me =]

-Evan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top