Why doesn’t GetAddrInfo work from behind a proxy?

Raymond Chen

Raymond

A customer was having a problem with the Get­Addr­Info function when running inside a corporate proxy environment.

We are trying to get the IP address of, say, www.microsoft.com by using the Get­Addr­Info function. This works fine if the computer is not behind a proxy, but if it is run in a corporate proxy environment, the call fails with WSAHOST_NOT_FOUND.

The Get­Addr­Info function operates at a level below proxies. When you have a Web proxy, the computer never actually talks to www.microsoft.com directly. Instead, you connect to the proxy and tell the proxy, “Please contact www.microsoft.com for me, thanks.” That’s why it’s called a “proxy”.

You never see the IP address of www.microsoft.com; the only IP address you see is that of the proxy. Besides, since you are inside a corporate proxy environment, even if you had the IP address for www.microsoft.com, it is if no use to you since you cannot connect to it.

There are products that try to smooth over this boundary, so that programs think that they are connected directly to the Internet when in fact they are talking through the proxy.

0 comments

Comments are closed.