Solved

windows socket: gethostbyname() via proxy

Posted on 2002-05-13
7
449 Views
Last Modified: 2013-11-20
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?
0
Comment
Question by:CHED
  • 3
  • 2
7 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 7005772
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.
0
 

Author Comment

by:CHED
ID: 7009975
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?
0
 

Author Comment

by:CHED
ID: 7009989
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?
0
 

Author Comment

by:CHED
ID: 7009993
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?
0
 
LVL 32

Accepted Solution

by:
jhance earned 80 total points
ID: 7010652
Since we're repeating ourselves here....


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.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ORA-01403: no data found 43 111
iSeries DB2 Query 2 98
Sed question 2 120
Work with App store 7 89
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question