As SOCKS proxy server can handle http requests as well along with socket requests. So I am trying to pass make http request through SOCKS proxy server, but I am not able to do that. I have successfully made socket request through SOCKS proxy server and http request through http proxy server. This is the way I made a http request through http proxy server. string sURL; sURL = textBoxWebAddress.Text;
WebRequest wrGETURL;
wrGETURL = WebRequest.Create(sURL);
WebProxy myProxy = new WebProxy(textBoxSOCKSHost.Text, int.Parse(textBoxSOCKSPort.Text));
myProxy.BypassProxyOnLocal = true;
wrGETURL.Proxy = myProxy;//WebProxy.GetDefaultProxy();
Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(objStream);
string sLine = "";
int i = 0;
while (sLine != null)
{
i++;
sLine = objReader.ReadLine();
if (sLine != null)
Console.Write(sLine);
}
But when I enter address and port of SOCKS proxy server, it gives connection failure error. What I am doing wrong? Thanks.