IPv6: Is `::’ equivalent to `0.0.0.0′ when listening for connections?

I believe that listening on a port on 0.0.0.0 is equivalent to listening on a port on any network adapter, at least my memory of the Windows socket API says that this is so.

That is correct. 0.0.0.0 is defined as INADDR_ANY and can be used to listen on all local IPv4 adapters.

It also makes sense to me that :: would mean the equivalent in IPv6 parlance so a listener on :::49156 would be listening to port 49156 on all IPv6 network adapters where as ::1:1434 would be port 1434 on only the IPv6 loopback adapter.

From the perspective of listening, yes. :: is defined as INADDR6_ANY and can be used to listen on all local IPv6 adapters. ::1 is defined as INADDR6_LOOPBACK.

I assume that IPv6 listen end-points only apply to IPv6 adapters. That is, if an adapter only had an IPv4 address, connections to it port 49156 would not be received by a listener on :::49156?

That depends on the listener. An IPv6-only listener cannot listen on an IPv4 adapter and cannot accept IPv4 clients. However, a dual-stack listener bound to INADDR6_ANY can bind to IPv4 and IPv6 adapters and accept both IPv4 and IPv6 clients, where IPv4 addresses are reported by accept(), WSAAccept(), and getpeername() as IPv4-mapped IPv6 addresses.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)