dyfet/ucommon — pull request #14 by aberaud (2014-05-30 14:55:53+00:00)
Title: Socket::address: add usefull methods

Following previous discussion, new method Socket::address::getSize() is renamed to Socket::address::getLength() to better fit with existing Socket::len(). Socket::address::getLength() now calls Socket::len().

While working on ucommon I also found some new methods to be useful. New constructors improve compatibility with standard structures, and allow easier integration with other libraries.

print() now allow to display a socket address in a human-readable format without performing any kind of lookup (unlike ::query), which is useful when writing endpoints for text-based protocols or for debugging.

withPort() turned out to be surprisingly useful, by allowing to build inline a copy of the address with a different port.