Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我见过INADDR_ANY在绑定套接字时使用“*”和“::”(对于 IPv6)来表示“任何地址”(即)的 API。我还看到使用“”或“0.0.0.0”表示相同含义的 API。是否有广泛使用的标准将“任何地址”写为字符串?
INADDR_ANY
这是两种方式。遗憾的是,没有一种适用于 IPv4 和 IPv6。绑定套接字时,您当然应该使用 INADDR_ANY。
这是一个好主意,有不止一种被广泛使用的写法。编程不好玩吗?