2

I have an application in C# that utilizes Winhttp to make web requests. Is there a way to specify which network card WinHTTP must utilize for its connections?

skaffman
  • 398,947
  • 96
  • 818
  • 769
webly
  • 327
  • 2
  • 7
  • 18

2 Answers2

2

There is no publically available option for WinHTTP or WinInet to do Interface Affinity. It appears to be supported in System.Net via the BindIPEndPointDelegate on the Request's ServicePoint.

I am curious what the scenario is to force a specific interface since it points to a problem in the rest of the stack to need such a thing.

Ari Pernick
  • 469
  • 4
  • 8
  • Another SO user has this problem (http://stackoverflow.com/questions/3387237/set-ip-preference-in-winhttp-c). The scenario is when IPv6 is mis-configured. As a wordaround he wants to force WinHttp to first try to use IPv4 rather than IPv6. Yes the system is mis-configured; that doesn't really help workaround a client's computer problems. – Ian Boyd Jul 17 '11 at 18:23
0

WinHTTP is at the wrong spot on the OSI model to deal with hardware level stuff like that. You're going to want to look at modifying the routing table instead.

lod3n
  • 2,893
  • 15
  • 16
  • can you elaborate a little more on the routing tables? – webly Sep 22 '09 at 23:47
  • Routing can't be properly explained in 600 characters. Google "Route Add". It's low level, and can take your system offline if used carelessly. – lod3n Sep 23 '09 at 04:02