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

[no subject]



hi everybody, 
   
   (1)
 im having a problem with the gethostbyaddr function.
i specify the
 the arguments as :-

        127.0.0.1  for the  constant  character
pointer,
        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
clearer:-
        |
        |   


  hptr=gethostbyaddr("127.0.0.1",4,AF_INET);
	if(hptr==NULL)
     { 
      printf("gethostbyaddress error for host: %s:
%s\n",ptr,hstrerror(h_errno));
	printf("gethostbyaddress function return NULL,
exiting \n");
	exit(0);	
       }	
printf("official hostaddress: %s\n",ptr);	
	printf("length of address= %d\n",hptr->h_length);	
	printf("official hostname: %s\n",hptr->h_name);
	for(pptr=hptr->h_aliases;*pptr!=NULL;pptr++)
	printf("\talias: %s\n",*pptr);
      

/**************/



(2)
 i  am trying to use libpcap (packet capture library) 
to develop
 a network analyzer(a modest one of course)  and i get
the 
 following message for pcap_open_live:-
 
 /dev/bpf0 not found


the code fragment is:-


if ( (pd = pcap_open_live(device, snaplen, 0, 500,
errbuf)) == NULL)
    {             printf("pcap_open_live:
%s\n",errbuf);
    }      


do i have to install libpcap  although i have  pcap
which is already
present  in  linux?

if yes,  then  how do i go about doing it???


ciao



__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com