> On QNX 4.25, I failed to execute function gethostbyname().
> I am sure something is wrong with my system configuration,but, I can't find
> it out and correct it.
Well the most likely thing that comes to mind is that the IP's
in your /etc/resolv.conf point to name servers that are not
working. You might want to try pinging them for starters.
Mitchell Schoenbrun --------- masc...@pobox.com
Thank you for any info.
Zhoujun
My host: *.*.75.96
My nameserver: *.*.75.90
My gateway: *.*.75.8
But,I could not ping to *.*.120.20 although system knows the gateway
*.*.75.8.
After adding the subnet by command "route add -net *.*.120 *.*.75.8", I
can ping to *.*.120.20. I also want to know this cause.
The problem about gethostbyname() still exists.
Mitchell Schoenbrun <masc...@pobox.com> wrote in message
news:Voyager.00083...@schoenbrun.com...
> Previously, zhoujun wrote in comp.os.qnx:
>
> > On QNX 4.25, I failed to execute function gethostbyname().
> > I am sure something is wrong with my system configuration,but, I can't
find
> > it out and correct it.
>
"zhoujun" <jz...@mail.nairc.ac.cn> wrote in message
news:8ol2a1$t7r$1...@inn.qnx.com...
> Thank you !
> After restarting my computer, I tried to ping some involved IP addresses,I
> found I can ping to any IP addresses in my subnet. And I can ping to my
> nameserver and web servers in Internet,too.
>
> My host: *.*.75.96
> My nameserver: *.*.75.90
> My gateway: *.*.75.8
>
> But,I could not ping to *.*.120.20 although system knows the gateway
> *.*.75.8.
> After adding the subnet by command "route add -net *.*.120 *.*.75.8", I
> can ping to *.*.120.20. I also want to know this cause.
>
> The problem about gethostbyname() still exists.
>
>
> Mitchell Schoenbrun <masc...@pobox.com> wrote in message
> news:Voyager.00083...@schoenbrun.com...
> > Previously, zhoujun wrote in comp.os.qnx:
> >
> > > On QNX 4.25, I failed to execute function gethostbyname().
> > > I am sure something is wrong with my system configuration,but, I can't
> find
> > > it out and correct it.
> >
I believe you want the netmask to be 255.255.0.0
Heather
Ivan
zhoujun <jz...@mail.nairc.ac.cn> wrote in message
news:8okteh$pvd$1...@inn.qnx.com...
Mario Charest <mcha...@zinformatic.com> wrote in message
news:8oli4j$7q7$1...@inn.qnx.com...
Heather Johnstone <hea...@qnx.com> wrote in message
news:8olmaf$4t4$1...@nntp.qnx.com...
And, the problem about gethostbyname() still exists either the netmask is
set to 255.255.0.0 or to 255.255.255.0.
Ivan Bannon <ivan....@rjginc.com> wrote in message
news:8omk1t$obg$1...@inn.qnx.com...
> And, the problem about gethostbyname() still exists either the netmask is
> set to 255.255.0.0 or to 255.255.255.0.
If you can, post "netstat -ni, netstat -nr", that will give a
clear picture of the connectivate.
1) is "ping *.*.75.90" works?
2) is "nslookup" contact the nameserver ? Is it showing you the right
server address (*.*.75.90)
3) What is "ping <somename>" returned ? Is it resolved the name?
4) The name you giveing "gethostbyname()", is it in /etc/hosts or
is it in nameserver? Can you "nslookup <thename>" to resolve it?
5) you may consider change your /etc/resolv.conf as:
domain nairc.ac.cn
lookup file bind
nameserver *.*.75.90
This will tell resolver check /etc/hosts first, if can't find,
check nameserver.
"netstat -ni" & "netstat -nr" can work well.
1) I can ping to *.*.120.20.
2) "nslookup" can contact the nameserver, and show the right IP address:
*.*.120.20.
3) For example,"ping www.qnx.com" returns the right IP address.
4)The name I give "gethostbyname()", for example, "node1", is in
"/etc/hosts",but not in my nameserver. I can't "nslookup node1" to resolve
it.
But I can get right response with "ping node1" or "telnet node1".
In the help documents on QNX, I find the following:
The nslookup utility won't look at /etc/hosts even if the lookup keyword
is used in /etc/resolv.conf.
5) I add "lookup file bind" to "/etc/resolv.conf" according to your
advice,but, "nslookup node1" still can't find "node1".
What's the matter?
Xiaodan Tang <xt...@qnx.com> wrote in message
news:8onccd$4da$1...@nntp.qnx.com...
> "netstat -ni" & "netstat -nr" can work well.
> 1) I can ping to *.*.120.20.
> 2) "nslookup" can contact the nameserver, and show the right IP address:
> *.*.120.20.
> 3) For example,"ping www.qnx.com" returns the right IP address.
> 4)The name I give "gethostbyname()", for example, "node1", is in
> "/etc/hosts",but not in my nameserver. I can't "nslookup node1" to resolve
> it.
> But I can get right response with "ping node1" or "telnet node1".
> In the help documents on QNX, I find the following:
> The nslookup utility won't look at /etc/hosts even if the lookup keyword
> is used in /etc/resolv.conf.
> 5) I add "lookup file bind" to "/etc/resolv.conf" according to your
> advice,but, "nslookup node1" still can't find "node1".
But your "gethostbyname("node1")" is succeesed, right? (Cause you could
ping/telnet to "node1").
nslookup using different resolver as others. It _ONLY_ talk to a nameserver,
resolving names. Others, ping/telnet, they using the resolver in libsocket,
which understand "lookup file bind", menas they will check /etc/hosts first,
then DNS.
Xiaodan Tang <xt...@qnx.com> wrote in message
news:8oobav$lul$1...@nntp.qnx.com...
I was confused.
Are you saying your "gethostbyname("node1")" is not succeeded even if
you could "ping node1" from the same QNX 4.25 machine? (ping _IS_
using gethostbyname() if you give it a name).
Xiaodan Tang <xt...@qnx.com> wrote in message
news:8ork56$jjc$1...@nntp.qnx.com...
That's strange. As I said, "ping" _IS_ using a gethostbyname() on
the node name you give it.
Can you do this:
# env
# ping -c1 node1
# cat <your test program>.c
# cc -o mytest <your test program>.c -lsocket
# ./mytest
Post the output of each command. The "your test program".c is
the program showing how your "gethostbyname()" failed.
-xiaodan
# env
_=/usr/bin/env
ABLPATH=/qnx4/photon/translations
PHOTON=//1/dev/photon
KBD=en_US_101.kbd
PATH=/bin:/etc:/usr/bin:/etc:/usr/ucb:/usr/local/bin:/qnx4/photon/bin:
/qnx4/photon/usr/bin:/qnx4/phtk/appbuilder:/usr/bin//photon
SHELL=/bin/sh
PHFONT=/dev/phfont
PHIG=1
PHTK_PATH=/qnx4/phtk
TMPDIR=/tmp
HOME=///
PHWM=pwm
CON_KBD=USA
USER_NAME=/dev/photon
TERM=qansi-m
TZ=wast-08
HZ=1000
ABLANG=en
PHOTON_PATH=/qnx4/photon
PHSTART=1
LOGNAME=root
SYSNAME=qnx4
# ping -c1 node1
PING node1.nairc.ac.cn (159.226.75.96): 56 data bytes
64 bytes from 159.226.75.96: icmp_seq=0 ttl=255 time=0 ms
--- node1.nairc.ac.cn ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0/0/0 ms
# cat test.c
#include <stdio.h>
#include <netdb.h>
main()
{
if(gethostbyname("node1")==NULL) printf("error\n");
}
# cc -o mytest test.c -lsocket
/usr/watcom/10.6/bin/wcc386 -zq -ms -4r -i=/usr/watcom/10.6/usr/include -i=/
usr/include t
est.c
/usr/watcom/10.6/bin/wlink op quiet form qnx flat na mytest op priv=3 op c
libp /usr/watc
om/10.6/usr/lib:/usr/lib:. f /home/empress/test.o l
/usr/watcom/10.6/usr/lib/socket3r.lib
op offset=40k op st=32k
# ./mytest
error
#