changed input parameters to be const pointers.

Also cleaned up compile warnings on OSX.
Adding support for using connect on dgram sockets.