[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re:



> >   hptr=gethostbyaddr("127.0.0.1",4,AF_INET);
<snip>

> Can't really tell from this distance but u might want 2 use htonl() on the
> address. I came up with something like this problem when code which worked
> on a Sun box wouldn't on an x86 box.

I think the problem is with the "len" argument to gethostbyaddr. You have
given it as 4, *why*? If you do a man gethostbyaddr, it clearly says that
the len is supposed to be the length of the const char *addr (the first
argument, which is a asciiz string).

So just fix that, it should solve your problem...