Recently I found out the hard way that when I give my
TcpListener.bind() argument as
"localhost:9111", the socket gets bound to IPv6
getaddrinfo on my system returns the IPv6 address first.
This is fine (my problem for not specifying my intent clearly enough), however the doc for
bind needs to specify what happens with
ToSocketAddrs impls that return multiple addresses (i.e. first successful one wins). It currently only says “… will be bound to the specified address.” as if only ever one address can be specified
Same is true for
TcpStream.connect(), although it will probably work mostly transparently in the latter case.