getaddrinfo()에 ip주소 입력해도 되나요?
글쓴이: 불량청년 / 작성시간: 수, 2016/10/19 - 10:27오전
감자기 궁금한게 생겼습니다.
보통 domain으로 된 주소를 DNS를 이용하여 ip 주소 얻을때 getaddrinfo()를 쓰는데요.
ex)
http://[2001:232:1234:5678::222]/test/test/test.dat
지금 domain address 대신에 IPv6 주소를 이용하여 connect에 사용하면 Network is Unreachable(errno 101)이 발생합니다.
실제 getaddressinfo()에 입력되는 값은 2001:232:1234:5678::222
http://test-ipv6.com/test/test/test.dat 이렇게 입력하면 접속이 되구요.
지금까지 별생각없이 사용했는데 getaddrinfo에 Domain대신 ip address를 넣으면 안되는 건가요?
Forums:
됩니다.
됩니다.
아래를 참고해보세요.
http://man7.org/linux/man-pages/man3/getaddrinfo.3.html
node specifies either a numerical network
address (for IPv4, numbers-and-dots notation as supported by
inet_aton(3); for IPv6, hexadecimal string format as supported by
inet_pton(3)), or a network hostname, whose network addresses are
looked up and resolved.
-------------------------------------------------------------------------------
It's better to appear stupid and ask question than to be silent and remain stupid.
댓글 달기