Updating socket fwrite check, fixes #10