TCP-based protocols are the most significant protocols used in network communication. Just as a reminder, HTTP, FTP, SMTP, and other protocols are part of this group. This recipe gives you an insight on how to connect to the TCP server in general.
Connecting to the remote server
How to do it...
- Open the console and create the folder chapter07/recipe02.
- Navigate to the directory.
- Create the tcpclient.go file with the following content:
package main
import (
"bufio"
"context"
"fmt"
"io"
"net"
"net/http"
"time"
)
type StringServer string
func (s StringServer...