dyfet/ucommon — pull request #10 by aberaud (2014-05-07 21:46:22+00:00)
Title: Add utility functions to Socket::address

Socket::address would be more convenient to use if it had more tools to make abstraction of IPv4 and IPv6 differences.

In particular, getPort() and setPort() allow to get/set the port associated with a sockaddr without considering the address family.

I was however not sure how to handle corner cases.
* I choose to make setPort change all addresses in the list, because I think people will expect the socket to be opened on the set port even if the first address does not work.
* The equality operator requires both lists to be the same (same addresses in the same order).
* The port could also be stored in addrinfo instead of sockaddr but the later made more sense to me. Should the corresponding addrinfo also be edited in address.setPort() ?