Refactored to work with OS X

[Changed] - socket import and all subsequent calls to the socket
module. Although the code is less readable, it made pyncp functional on
Mac OS X.