fix wrong usage of socket

should fix #59
Merge pull request #60 from lestrrat/fix_socket_usage

fix wrong usage of socket