What are the fields printed by getent ahosts DOMAIN?

The output for getent hosts is a simple combination of IP and hostname. The getent ahosts has an additional third field that is, in all my test, either STREAM, DGRAM or RAW.

Output for getent hosts example.net

2001:500:88:200::10 example.net

and for getent ahosts example.net

2001:500:88:200::10 STREAM example.net
2001:500:88:200::10 DGRAM  
2001:500:88:200::10 RAW     STREAM     DGRAM     RAW

1 Answer 1


getent ahosts uses getaddrinfo() and extracts from the addrinfo struct the values of ai_addr, ai_socktype, and ai_canonname and prints them out in order as: IPv4/IPv6 address, socket type, and canonical name (if it has one).

SOCK_STREAM (reliable stream-oriented service or Stream Sockets)
SOCK_DGRAM (datagram service or Datagram Sockets)
SOCK_SEQPACKET (reliable sequenced packet service), or
SOCK_RAW (raw protocols atop the network layer).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .