Overriding the default Linux kernel 20-second TCP socket connect timeout
Whatever language or client library you're using, you should be able to set the timeout on network socket operations, typically split into a connect timeout, read timeout, and write timeout.