Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sat, 5 Feb 2005 12:40:59 GMT Message-Id: <200502051240.j15CevQ32345@webmail.web-mania.com> Content-Disposition: inline Content-Transfer-Encoding: binary Mime-Version: 1.0 From: HelpBytes To: cygwin AT cygwin DOT com Subject: gethostbyname() problem? Reply-To: helpbytes AT helpbytes DOT co DOT uk Content-Type: text/plain X-Origin: 213.249.186.82 The following code performs a lookup at a DNS block list, the DNS has an entry for this, and returns 127.0.0.2. In Linux using gcc, and in Windows using Visual Studio, this code works fine, and outputs 127.0.0.2. However, in cygwin, it simply outputs 202.149.167.69., it seems no matter what is in the hostname, if it begins with what looks like an IP address, it returns it as the result. It would appear I am using Cygwin Dll Version 1.5.12-1 Unfortunately, I cannot connect to your website the last 24hrs to check for the proper place, if there is one, to post this message. Output: $g++ -o lookup lookup.cpp $ ./lookup.exe 202.149.167.69. --Code Follows-- #ifdef WIN32 #include #else #include #endif #include int main() { struct hostent *host; #ifdef WIN32 WSADATA wsa; WSAStartup(MAKEWORD(1,1),&wsa); #endif host = gethostbyname("202.149.167.69.sbl-xbl.spamhaus.org"); if (host==NULL) { std::cout << h_errno; return 0; } for (int i=0;i<4;i++) { std::cout << (int)((unsigned char)host->h_addr_list[0][i]) << ". "; } #ifdef WIN32 WSACleanup(); #endif } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/