Solved

windows socket: gethostbyname() via proxy

Posted on 2002-05-13
7
407 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Different colored text in ComboBox without Subclassing 8 45
not able to insert into temp table 68 150
maxBlock challenge 30 100
noX challenge 17 76
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now