Add socket timeout.
Add exception handling.