I am absolutely new to the Network Programming...
Can anyone help me with the following?
I need to dynamically map and IP to a specific host name, and then execute the HttpWebRequest to that host name. Can you suggest how to do that?
The scenario:
I have a list of IPs and I need to map them to "some.web.com," by taking each of the IPs maping it to the host name and checking whether the connection exists, if it exists - do a webrequest....
Thanks in advance.
sample code:
I am trying to create the host entry:
(using internal IPs)
System.Net.IPHostEntry he = new IPHostEntry();
he.HostName = "some.web.com";
System.Net.IPAddress[] ipaddrs = {
System.Net.IPAddress.Parse("192.168.10.40"),
System.Net.IPAddress.Parse("192.168.10.50"),
System.Net.IPAddress.Parse("192.168.10.55"),
System.Net.IPAddress.Parse("192.168.10.60"),
System.Net.IPAddress.Parse("192.168.10.65")
};
he.AddressList = ipaddrs;
Then I need to connect to a site (but I want the connection to use one of the IPs above not the public IP)
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http;//some.web.com/folder/file.html");
HttpWebResponse wresponse = (HttpWebResponse) wr.GetResponse();
PLEASE HELP!!!
Can anyone help me with the following?
I need to dynamically map and IP to a specific host name, and then execute the HttpWebRequest to that host name. Can you suggest how to do that?
The scenario:
I have a list of IPs and I need to map them to "some.web.com," by taking each of the IPs maping it to the host name and checking whether the connection exists, if it exists - do a webrequest....
Thanks in advance.
sample code:
I am trying to create the host entry:
(using internal IPs)
System.Net.IPHostEntry he = new IPHostEntry();
he.HostName = "some.web.com";
System.Net.IPAddress[] ipaddrs = {
System.Net.IPAddress.Parse("192.168.10.40"),
System.Net.IPAddress.Parse("192.168.10.50"),
System.Net.IPAddress.Parse("192.168.10.55"),
System.Net.IPAddress.Parse("192.168.10.60"),
System.Net.IPAddress.Parse("192.168.10.65")
};
he.AddressList = ipaddrs;
Then I need to connect to a site (but I want the connection to use one of the IPs above not the public IP)
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http;//some.web.com/folder/file.html");
HttpWebResponse wresponse = (HttpWebResponse) wr.GetResponse();
PLEASE HELP!!!