Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

windows socket: gethostbyname() via proxy

Posted on 2002-05-13
7
444 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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
sum67 challenge 35 109
twoTwo  challenge 35 107
scoreUp challenge 14 64
Capture logon name 13 87
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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 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