Set timeout for socket before connect, not after
Merge pull request #1 from hvnsweeting/hvn-fix-socket-timeout

Set timeout for socket before connect, not after