Link to home
Start Free TrialLog in
Avatar of CHED
CHED

asked on

windows socket: gethostbyname() via proxy

I want to use gethostbyanme() on a client PC to validate some host names. My connection to Internet is through a proxy server, there is also a firewall. The function alsways return NULL, even on those definatly valid host names. But it works fine within the intranet. I want to know if it is because the proxy server or the firewall or both, and how to get around it?
Avatar of jhance
jhance

You can't do this through a proxy.  When you are behind a proxy, the proxy does all the hostname resolution for your browser.  So the HTTP proxy protocol send the full URL and hostname to the proxy, which then resolves the host and performs the request.

On your system, there must be a DNS server defined that can resolve hostnames.  If not, or if the DNS server is a local server only, you will not be able to resolve hostnames that your DNS server doesn't know about.  And since you are behind the proxy, you cannot connect to an outside DNS server either.

Talk to your network admin about getting a "hole" through the firewall to do what you need to do.
Avatar of CHED

ASKER

Hi jhance,
Thanks for your comment.
Is it possible to use my current internet path on the proxy server to send the "gethostbyname" command to the outside world? For instance, my proxy server is "suchsuch" at prot:80, my question is can you direct the command to go through this path, as what IE does?
Avatar of CHED

ASKER

Hi jhance,
Thanks for your comment.
Is it possible to use my current internet path on the proxy server to send the "gethostbyname" command to the outside world? For instance, my proxy server is "suchsuch" at prot:80, my question is can you direct the command to go through this path, as what IE does?
Avatar of CHED

ASKER

Hi jhance,
Thanks for your comment.
Is it possible to use my current internet path on the proxy server to send the "gethostbyname" command to the outside world? For instance, my proxy server is "suchsuch" at prot:80, my question is can you direct the command to go through this path, as what IE does?
ASKER CERTIFIED SOLUTION
Avatar of jhance
jhance

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial