Message-ID: <38F71414.2C54D23D@corel.com> Date: Fri, 14 Apr 2000 08:50:28 -0400 From: Jonathan Meunier X-Mailer: Mozilla 4.7 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: How to use the "gethostbyname" function References: <482568C1 DOT 002EF512 DOT 00 AT mercury DOT shanghaigm DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 120.150.3.42 X-Trace: 14 Apr 2000 08:51:41 -0500, 120.150.3.42 Lines: 24 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I looked in the lib info, and gethostbyname isn't a DJGPP function, though gethostname is. If this is the one, then type "info libc alpha gethost" at the DOS prompt. It also has an exemple on how the function is used.. HTH, .(Trancelucid). . Jaune . tao_Zhou AT Shanghaigm DOT com wrote: > > 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!