Create our own socket connections

This allows the user to set the socket options before the connection is
established. The previous approach of setting the options after the connection
was established was not correct.
Is there any downside to doing it before bind? Should I just make the change for v1.9.1?