I searched all about how to use BindIPEndPointDelegate to change the source port of my HttpWebRequest. I found some posts on this subject:
Here and here
However, it does not seem to work for me. I found the same problem with this guy: Define outgoing / calling port for SOAP web service in Visual Studio 2010
Basically, I want to change the source port when connecting to a web page. BindIPEndPointDelegate is pretty advanced.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); req.ServicePoint.BindIPEndPointDelegate = (servicePoint, remoteEp, retryCount) => { return new IPEndPoint(IPAddress.Any, 8086); };
When I look at connections with netstat -n, I expect to see myipaddress: 8086 as the source and destination IP address: 80. What I see in netstat is that it creates a loopback (127.0.0.1:8086) with my specified port. See screenshot netstat -n
Since this is my first post, I can not send images. So the image can be found here
Why is BindIPEndPointDelegate creating a feedback connection and how can I make my WebRequest behave like a browser with my specified port?
I am in a win7 Pro window, without a local firewall, without missing a proxy.
source share