delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/14/14:46:16

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to use the "gethostbyname" function
Date: 14 Apr 2000 12:33:50 -0700
Organization: InterWorld Communications
Lines: 23
Message-ID: <831z484gv5.fsf@mercury.st.hmc.edu>
References: <482568C1 DOT 002EF512 DOT 00 AT mercury DOT shanghaigm DOT com>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 955741092 25410 134.173.45.219 (14 Apr 2000 19:38:12 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 14 Apr 2000 19:38:12 GMT
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

tao_Zhou AT Shanghaigm DOT com writes:

> In my program, I used the function "gethostbyname"
> by which we can get the ip address through the hostname.
> But to my surprise, it dosen't work as i expected. The way
> i used it  is as followed:
> if((h=gethostbyname(hostname))==NULL)
> {    herror(strerror);
>      printf("%s",strerror);
> }
> Everytime when i run the program, it always told me the
> same message: unknown host.
> What's up? Who can tell me how to satisfy this awful
> function to make my program run properly?
>  hungry for your help!

DJGPP doesn't have network support built in.  You'll have to use an
add-on library; several are on Simtelnet.

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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