Get network_linux.c to build under MacOS X

This patch works on my 10.9.2 box by using `setsocket(..., SOL_SOCKET, SO_NOSIGPIPE)`  instead of passing the `MSG_NOSIGNAL` flag to `send`.

The second small patch ensures that the new `SO_NOSIGPIPE` `setsockopt` call isn't made if the `connect` call fails, by adding a `closesocket()` and `return -1` to the `net_linux_createsocket` function when this error happens.  I've kept this separate because I'm unsure if the failure to close the socket in these circumstances was deliberate or not.