ipv6::地址是什么意思?

What's the meaning of ipv6 :: address?

在我的代码中,我发现我的初始客户端和服务器配置具有 ipv6 地址:::(相当于 0:0:0:0:0:0:0:0?)。

struct SslConfigurations 
{
    std::string         clientIp{"::"};
    std::string         serverIp{"::"};
    UInt16              clientPort{0U};
    UInt16              serverPort{0U};
    ssl::SocketType     type{};
    ssl::SSLReturnCodes errorCode{};
};

这个地址是什么意思? 这个地址不改还能用吗?

只是中间出现的四零组(0000)的简写,可以省略。它在示例中更明显:

地址2001:0db8:0000:0000:0000:8a2e:0370:7334变为2001:db8::8a2e:370:7334

::表示0000:0000:0000:0000:0000:0000:0000:0000

::地址与IPv4世界中的00.0.0.0意义相同:代表所有网络。

:: 是编写 未指定 IPv6 地址 的一种便捷方式,它是一个全零保护值,用于指示缺少有效地址地址。

这是来自 IBM's online documentation 的相关引述:

The unspecified address is 0:0:0:0:0:0:0:0. You can abbreviate the address with two colons (::). The unspecified address indicates the absence of an address, and it can never be assigned to a host. It can be used by an IPv6 host that does not yet have an address assigned to it. For example, when the host sends a packet to discover if an address is used by another node, the host uses the unspecified address as its source address.