471,897 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,897 software developers and data experts.

TcpCLient on Proxy

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.

************************************************** **************************
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.
************************************************** **************************

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

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 =]

Nov 16 '05 #1
0 1481

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by מורדי | last post: by
10 posts views Thread by Abubakar | last post: by
5 posts views Thread by Wal Turner | last post: by
reply views Thread by Tamas Bojcan | last post: by
6 posts views Thread by Julien | last post: by
reply views Thread by aladdinm1 | last post: by
4 posts views Thread by Peter | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.