Move resolving functionality to resolver.m

This is in preparation for UDP sockets, so that they can share the
resolving functionality with TCP sockets.