Setting the Timeout Period on the Server Side

Let’s learn how to set the timeout period on the server side.

We'll cover the following

This lesson presents a technique for timing out network connections that take too long to finish on the server side. This is much more important than the client side because a server with too many open connections might not be able to process more requests unless some of the already open connections close. This usually happens for two reasons. The first reason is software bugs, and the second reason is when a server is experiencing a denial of service (DoS) attack!

Coding example

The main() function in timeoutServer.go shows the technique:

Get hands-on with 1200+ tech skills courses.