In this section, you will learn how to develop a concurrent TCP server using goroutines. For each incoming connection to the TCP server, the program will start a new goroutine to handle that request. This allows it to accept more requests, which means that a concurrent TCP server can serve multiple clients simultaneously.
The job of the TCP concurrent server is to accept a positive integer and return a natural number from the Fibonacci sequence. If there is an error in the input, the return value will be -1. As the calculation of numbers in the Fibonacci sequence can be slow, we are going to use an algorithm that was first presented in Chapter 11, Code Testing, Optimization, and Profiling, and was included in benchmarkMe.go. Additionally, this time, the algorithm used will be explained a little more.
The name of the program is fiboTCP.go, and its code is...