Networking Forums

Networking Forums > Computer Networking > Linux Networking > Trouble with getbyhostname()

Reply
Thread Tools Display Modes

Trouble with getbyhostname()

 
 
sam.barker0@gmail.com
Guest
Posts: n/a

 
      03-26-2008, 01:03 PM
Hi,
I am having trouble with getbyhostname().I works sometimes but on
other occasions it crashes.
IPADDRESS is a string say "192.123.12.1"

(gdb)
Client::SendSocket (this=0xbfa9493c, QuerBuf=@0xbfa948c4,
IPADDRESS=@0xbfa948d4) at Client.cc:141
141 h = gethostbyname(IPADDRESS.c_str());
(gdb)
*** glibc detected *** /home/workspace/DNSResolver1/checkstring:
free(): invalid next size (normal): 0x0804eb38 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7db1d65]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7db5800]
/lib/tls/i686/cmov/libc.so.6(fclose+0x134)[0xb7da06f4]
/lib/tls/i686/cmov/libc.so.6[0xb7e2a73d]
/lib/tls/i686/cmov/libc.so.6(__res_ninit+0x25)[0xb7e2ae65]
/lib/tls/i686/cmov/libc.so.6(__res_maybe_init+0x7b)[0xb7e2c30b]
/lib/tls/i686/cmov/libc.so.6(__nss_hostname_digits_dots+0x2d)
[0xb7e2dcdd]
/lib/tls/i686/cmov/libc.so.6(gethostbyname+0x9a)[0xb7e3227a]
 
Reply With Quote
 
 
 
 
Robert Harris
Guest
Posts: n/a

 
      03-26-2008, 02:08 PM
(E-Mail Removed) wrote:
> Hi,
> I am having trouble with getbyhostname().I works sometimes but on
> other occasions it crashes.
> IPADDRESS is a string say "192.123.12.1"


Well, gethostbyname really does work, honest. So you will have to send
us a snippet of your code if you want advice on what is wrong with it.

Robert

>
> (gdb)
> Client::SendSocket (this=0xbfa9493c, QuerBuf=@0xbfa948c4,
> IPADDRESS=@0xbfa948d4) at Client.cc:141
> 141 h = gethostbyname(IPADDRESS.c_str());
> (gdb)
> *** glibc detected *** /home/workspace/DNSResolver1/checkstring:
> free(): invalid next size (normal): 0x0804eb38 ***
> ======= Backtrace: =========
> /lib/tls/i686/cmov/libc.so.6[0xb7db1d65]
> /lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7db5800]
> /lib/tls/i686/cmov/libc.so.6(fclose+0x134)[0xb7da06f4]
> /lib/tls/i686/cmov/libc.so.6[0xb7e2a73d]
> /lib/tls/i686/cmov/libc.so.6(__res_ninit+0x25)[0xb7e2ae65]
> /lib/tls/i686/cmov/libc.so.6(__res_maybe_init+0x7b)[0xb7e2c30b]
> /lib/tls/i686/cmov/libc.so.6(__nss_hostname_digits_dots+0x2d)
> [0xb7e2dcdd]
> /lib/tls/i686/cmov/libc.so.6(gethostbyname+0x9a)[0xb7e3227a]

 
Reply With Quote
 
Jurgen Haan
Guest
Posts: n/a

 
      03-26-2008, 02:23 PM
Uhm... not being a programmer, or anything, but isn't gethostbyname used
for resolving names into adresses and not the other way around?

(E-Mail Removed) wrote:
> Hi,
> I am having trouble with getbyhostname().I works sometimes but on
> other occasions it crashes.
> IPADDRESS is a string say "192.123.12.1"
>
> (gdb)
> Client::SendSocket (this=0xbfa9493c, QuerBuf=@0xbfa948c4,
> IPADDRESS=@0xbfa948d4) at Client.cc:141
> 141 h = gethostbyname(IPADDRESS.c_str());
> (gdb)
> *** glibc detected *** /home/workspace/DNSResolver1/checkstring:
> free(): invalid next size (normal): 0x0804eb38 ***
> ======= Backtrace: =========
> /lib/tls/i686/cmov/libc.so.6[0xb7db1d65]
> /lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7db5800]
> /lib/tls/i686/cmov/libc.so.6(fclose+0x134)[0xb7da06f4]
> /lib/tls/i686/cmov/libc.so.6[0xb7e2a73d]
> /lib/tls/i686/cmov/libc.so.6(__res_ninit+0x25)[0xb7e2ae65]
> /lib/tls/i686/cmov/libc.so.6(__res_maybe_init+0x7b)[0xb7e2c30b]
> /lib/tls/i686/cmov/libc.so.6(__nss_hostname_digits_dots+0x2d)
> [0xb7e2dcdd]
> /lib/tls/i686/cmov/libc.so.6(gethostbyname+0x9a)[0xb7e3227a]

 
Reply With Quote
 
Rick Jones
Guest
Posts: n/a

 
      03-26-2008, 03:44 PM
Jurgen Haan <(E-Mail Removed)> wrote:
> Uhm... not being a programmer, or anything, but isn't gethostbyname
> used for resolving names into adresses and not the other way around?


Yes, but for the last decade or so just about everyone's
gethostbyname() is willing to take-in an IPv4 address as a
dotted-decimal string.

However, for the last, oh five years or so, people should be migrating
to getaddrinfo() rather than gethostbyname()...

rick jones
--
denial, anger, bargaining, depression, acceptance, rebirth...
where do you want to be today?
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
 
Reply With Quote
 
Unruh
Guest
Posts: n/a

 
      03-26-2008, 07:56 PM
Rick Jones <(E-Mail Removed)> writes:

>Jurgen Haan <(E-Mail Removed)> wrote:
>> Uhm... not being a programmer, or anything, but isn't gethostbyname
>> used for resolving names into adresses and not the other way around?


>Yes, but for the last decade or so just about everyone's
>gethostbyname() is willing to take-in an IPv4 address as a
>dotted-decimal string.


>However, for the last, oh five years or so, people should be migrating
>to getaddrinfo() rather than gethostbyname()...


Which unfortunately has ( or maybe had) a problem in that it would not use
the local hosts file but went out to the dns server for everything.



>rick jones
>--
>denial, anger, bargaining, depression, acceptance, rebirth...
> where do you want to be today?
>these opinions are mine, all mine; HP might not want them anyway...
>feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

 
Reply With Quote
 
Rick Jones
Guest
Posts: n/a

 
      03-26-2008, 10:51 PM
Unruh <unruh-(E-Mail Removed)> wrote:
> Rick Jones <(E-Mail Removed)> writes:
> >However, for the last, oh five years or so, people should be
> >migrating to getaddrinfo() rather than gethostbyname()...


> Which unfortunately has ( or maybe had) a problem in that it would
> not use the local hosts file but went out to the dns server for
> everything.


I would expect that is had rather than has as I've been using it
without reported trouble (of that sort at least) in netperf for a few
years now.

rick jones
--
denial, anger, bargaining, depression, acceptance, rebirth...
where do you want to be today?
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TROUBLE! Help please! Cyphos Windows Networking 1 12-15-2005 04:39 PM
ICS trouble j.roffel Wireless Networks 1 07-15-2005 06:36 AM
WAG54G and ZoneAlarm..... trouble trouble trouble... MP Wireless Internet 4 07-28-2004 10:42 AM
Trouble Installing Linux/Cisco VPN Client Has anyone had trouble compiling the linux cisco vpn client? Here is the output of the install script: # uname -rviosm Linux 2.4.22-1.2188.nptl #1 Wed Apr 21 20:19:18 EDT 2004 x86_64 x86_64 GNU/Linux JSH Linux Networking 4 07-02-2004 12:48 PM
MN-720 trouble Chris Broadband Hardware 1 01-23-2004 12:13 PM



1 2 3 4 5 6 7 8 9 10 11