Redhat 5.2 a gethosbyaddr

David Rohleder davro na ics.muni.cz
Úterý Prosinec 15 11:29:11 CET 1998


konfera na netax.sk (Juraj Kovac) writes:

> Caute.
> Co poviete na nasledujuci problem?
> 
> # include <netdb.h>
> # include <sys/socket.h>
> # include <errno.h>
> 
> main(int argc, char *argv[])
> {
> struct hostent *hp;
> 
> hp = gethostbyaddr(argv[1], 16, AF_INET);

Podle Stevense: 

struct hostent *gethostbyaddr(char *addr, int len, int type);

addr je ukazatel na strukturu in_addr

type musi byt AF_INET, ale to je v Linuxu jenom
#define AF_INET		PF_INET

> if (hp) printf ("%s\n", hp->h_name);
> else perror("gethostbyaddr");

pro tyto ucely je definovana funkce:

void herror(const char *s);

vytiskne chybovou hlasku podle hodnoty h_errno na stderr

> }
> 
> ked to spustim, tak mi to vypise:
> gethostbyaddr: Address family not supported by protocol
> 
> Tak som z toho magor, ved som tam uviedol type AF_INET, iny to ani
> nepodporuje podla man gethostbyaddr.
> Mam nejak zle nakonfigurovany resolver?
> 


-------------------------------------------------------------------------
David Rohleder						davro na ics.muni.cz
Institute of Computer Science, Masaryk University
Brno, Czech Republic
-------------------------------------------------------------------------


Další informace o konferenci Linux