태그 보관물: glibc

glibc

“getent ahosts”의 결과는 무엇입니까? STREAM, DGRAM또는 RAW. 출력

필드는 무엇입니까 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_socktypeai_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).

답변