Trouble with getbyhostname()

S

sam.barker0

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]
 
A

abubakarm

Hi, i think this a wrong group to post the kind of problem that u r
looking to solve. You have to find some newsgroup where sockets
related stuff is discussed.

Regards,
..ab
 
S

sam.barker0

I was thinking that it might not be a networking related issue but a
memory related issue.I cannot seem to put my figure on it
After the error.The was a memory map.
====== Memory map: ========
08048000-0804c000 r-xp 00000000 08:06 1619927 /home/workspace/
backup/DNSResolver1/checkstring
0804c000-0804d000 rw-p 00003000 08:06 1619927 /home/workspace/
backup/DNSResolver1/checkstring
0804d000-0806e000 rw-p 0804d000 00:00 0 [heap]
b7b00000-b7b21000 rw-p b7b00000 00:00 0
b7b21000-b7c00000 ---p b7b21000 00:00 0
b7cbf000-b7cc0000 rw-p b7cbf000 00:00 0
b7cc0000-b7e04000 r-xp 00000000 08:06 2095711 /lib/tls/i686/cmov/
libc-2.6.1.so
b7e04000-b7e05000 r--p 00143000 08:06 2095711 /lib/tls/i686/cmov/
libc-2.6.1.so
b7e05000-b7e07000 rw-p 00144000 08:06 2095711 /lib/tls/i686/cmov/
libc-2.6.1.so
b7e07000-b7e0a000 rw-p b7e07000 00:00 0
b7e0a000-b7e14000 r-xp 00000000 08:06 2060358 /lib/libgcc_s.so.1
b7e14000-b7e15000 rw-p 0000a000 08:06 2060358 /lib/libgcc_s.so.1
b7e15000-b7e16000 rw-p b7e15000 00:00 0
b7e16000-b7e39000 r-xp 00000000 08:06 2095715 /lib/tls/i686/cmov/
libm-2.6.1.so
b7e39000-b7e3b000 rw-p 00023000 08:06 2095715 /lib/tls/i686/cmov/
libm-2.6.1.so
b7e3b000-b7f23000 r-xp 00000000 08:06 1128811 /usr/lib/libstdc++.so.
6.0.9
b7f23000-b7f26000 r--p 000e8000 08:06 1128811 /usr/lib/libstdc++.so.
6.0.9
b7f26000-b7f28000 rw-p 000eb000 08:06 1128811 /usr/lib/libstdc++.so.
6.0.9
b7f28000-b7f2e000 rw-p b7f28000 00:00 0
b7f3d000-b7f3f000 rw-p b7f3d000 00:00 0
b7f3f000-b7f59000 r-xp 00000000 08:06 2060373 /lib/ld-2.6.1.so
b7f59000-b7f5b000 rw-p 00019000 08:06 2060373 /lib/ld-2.6.1.so
bf985000-bf99b000 rw-p bf985000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
 
V

Victor Bazarov

I was thinking that it might not be a networking related issue but a
memory related issue.I cannot seem to put my figure on it
After the error.The was a memory map.

"Put my finger on it". And see FAQ 5.8.

V
 
D

dave_mikesell

I was thinking that it might not be a networking related issue but a
memory related issue.I cannot seem to put my figure on it

Post the smallest piece of code that compiles and exhibits the problem
and we might be able to help. Memory-related problems occur for a
variety of reasons.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top