I want to adapt my old C codebases, that were written for IPv4, to work with IPv6. What do I need to change so that my C code works with both IPv4 and IPv6?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Find all code that uses
inet_aton,inet_ntoa,gethostbyname,gethostbyaddr,htonl,htons,ntohl,ntohs, and any directsockaddr_inmanipulation and replace it with simple calls togetaddrinfoorgetnameinfo. This will make your code much simpler and more maintainable and IPv6 will automatically work with no additional effort.