linux - Why are gethostbyname and gethostbyaddr considered obsolete? -
the man page gethostbyname
(3) states functions gethostbyname
, gethostbyaddr
obsolete, , getaddrinfo
(3) , getnameinfo
(3) should used instead. doesn't, however, explain reason why former obsolete. can please point me resource explains matter further?
from opengroup
the
gethostbyaddr()
andgethostbyname()
functions may return pointers static data, may overwritten subsequent calls of these functions.the
getaddrinfo()
,getnameinfo()
functions preferred ongethostbyaddr()
,gethostbyname()
functions.
posix cautions gethostbyaddr()
andgethostbyname()
may withdrawn in future version of spec. other reason these 2 functions can't work ipv6 well, getaddrinfo()
, getnameinfo()
should used instead.
Comments
Post a Comment