필드는 무엇입니까 getent ahosts DOMAIN
?
에 대한 출력 getent hosts
은 IP와 호스트 이름의 간단한 조합입니다. 는 getent ahosts
나의 모든 시험에서, 추가로 세 번째 필드를 가지고, 중 STREAM
, DGRAM
또는 RAW
.
출력 getent hosts example.net
2001:500:88:200::10 example.net
그리고 getent ahosts example.net
2001:500:88:200::10 STREAM example.net
2001:500:88:200::10 DGRAM
2001:500:88:200::10 RAW
192.0.43.10 STREAM
192.0.43.10 DGRAM
192.0.43.10 RAW
답변
getent ahosts
용도 getaddrinfo()
로부터 추출 addrinfo
구조체의 값 ai_addr
, ai_socktype
및 ai_canonname
및 인쇄 그들을 같은 순서 : 의 IPv4 / IPv6 주소 , 소켓 타입 , 그리고 정식 이름 (있는 경우).
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).