[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
On Mon, 5 Jun 2000, PRAKASH GOWRI wrote:
> hi everybody,
> im having a problem with the gethostbyaddr function.
> i specify the
> the arguments as :-
> 127.0.0.1 for the constant character
> 4 as the size (for ipv4 address),
> AF_INET for the family.
> but i get hptr=NULL which is the pointer to the
> hostent structure.
> i dont know if i am doing anything wrong!!!!!!!
> the following code fragment will make things
> printf("gethostbyaddress error for host: %s:
> printf("gethostbyaddress function return NULL,
> exiting \n");
> printf("official hostaddress: %s\n",ptr);
> printf("length of address= %d\n",hptr->h_length);
> printf("official hostname: %s\n",hptr->h_name);
> printf("\talias: %s\n",*pptr);
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.
- Prev by Subject:
- Next by Subject:
- Previous by thread:
- Next by thread: