Use timeout value in connect, handle socket errors.