...

/

Developing Concurrent TCP Servers

Developing Concurrent TCP Servers

Let’s learn how to develop concurrent TCP servers with Go.

We'll cover the following...

This lesson teaches a pattern for developing concurrent TCP servers, which are servers that are using separate goroutines to serve their clients following a successful Accept() call. Therefore, such servers can serve multiple TCP clients at the same time. This is how real-world production servers and services are implemented.

Coding example

The code of concTCP.go is as follows:

Press + to interact
package main
import (
"bufio"
"fmt"
"net"
"os"
"strconv"
"strings"
)
var count = 0
func handleConnection(c net.Conn) {
fmt.Print(".")
...