delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/27/11:19:36

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Ronald Landheer" <ronald AT landheer DOT com>
To: <cygwin AT cygwin DOT com>
Subject: gethostbyaddr() doesn't work for localhost under W32/9x
Date: Tue, 27 Aug 2002 17:15:24 +0200
Message-ID: <NFBBLOMHALONCDMPGBLFCELEDKAA.ronald@landheer.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
In-Reply-To: <20020827110506.68511.qmail@web21008.mail.yahoo.com>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Importance: Normal

------=_NextPart_000_002B_01C24DED.54BDADA0
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hello all,

  I have a small question: gethostbyaddr() doesn't work for localhost=20
under W32/9x: the error set in errno is "operation not permitted".
I've attached the smallest testcase I can think of. What I'd like to=20
know is why this doesn't work, while gethostbyname() on localhost works=20
like a charm? Is this a bug in my brain, in W32/9x or in Cygwin=20
(probably the second, possibly the first)

Ronald

NB: Work won't allow to spend time on Cygwin - so I won't be able to=20
    fix anything as I won't be able to get the release form signed.=20
    Should be possible in three months though: work won't exist anymore=20
    :)


------=_NextPart_000_002B_01C24DED.54BDADA0
Content-Type: application/octet-stream;
	name="Makefile"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="Makefile"

all : test

test : test.cc
	gcc -Wall -Werror -g -o test test.cc
	
clean :
	rm -f *.exe *.o *~ test
------=_NextPart_000_002B_01C24DED.54BDADA0
Content-Type: application/octet-stream;
	name="test.cc"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="test.cc"

#include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>

int main(void) {
	unsigned long int i_IP;
	struct hostent *host_info;
	
	i_IP = inet_addr("127.0.0.1");
	host_info = gethostbyaddr((char *)&i_IP, sizeof(i_IP), AF_INET);
	if (host_info == NULL) perror("Failed!");
} // main()

------=_NextPart_000_002B_01C24DED.54BDADA0
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------=_NextPart_000_002B_01C24DED.54BDADA0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019