ZBLOG

inet_pton

inet_pton is a function used in computer programming to convert an IPv4 or IPv6 address from text format to binary form. The “pton” in the name stands for “presentation-to-network”, indicating that the function takes an IP address in presentation (human-readable) format and converts it to network (machine-readable) format.

The inet_pton function is part of the standard C library and can be used on any operating system that supports networking. It takes two arguments: the first is an integer representing the IP address version (either AF_INET for IPv4 or AF_INET6 for IPv6), and the second is a pointer to a character array containing the IP address string.

The function returns 1 if successful, indicating that the conversion was completed successfully and that the resulting binary representation of the IP address is stored in a structure pointed to by its third argument. If there is an error, such as an invalid IP address string or unsupported IP version, inet_pton returns 0.

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://sdn.0voice.com/?id=997

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?