concept timeout in category go

This is an excerpt from Manning's book Go in Practice.
The changes to the code are minimal. Instead of using the regular net.Dial, this code has net.DialTimeout, which adds a nicety to the regular net.Dial call: it specifies how long it’ll wait for the connection before giving up. You set this to 30 seconds. With TCP, the timeout includes time to send the message and receive the ACK. But with UDP, you set the timeout largely for just how long it takes your app to resolve the address and send the message. Setting a timeout gives you a little bit of a safety net when the network isn’t functioning as expected.
This chapter starts with the basics of REST APIs and quickly moves on to handling cases that don’t go as planned. You’ll look at detecting timeout failures, including those that Go doesn’t formally flag as timeouts. You’ll also look at resuming file transfers when timeouts happen, and you’ll learn how to pass errors between an API endpoint and a requesting client.
Reliably detecting a timeout is useful, and the next technique highlights this in practice.