Add Mac OS X support to socket wrapper