catch exceptions and set socket timeout