nn_socket() returns -1 on error

fix #6
Merge pull request #7 from brunoqc/fix

Properly check the return code when creating a socket