August 2019
Beginner to intermediate
798 pages
17h 2m
English
Go offers a different family of functions that also allows you to develop TCP clients and servers. In this section, you will learn how to program a TCP client using these functions.
The name of the TCP client will be otherTCPclient.go, and it is going to be presented in four parts. The first code segment from otherTCPclient.go is as follows:
package main
import (
"bufio"
"fmt"
"net"
"os"
"strings"
)
The second code portion from otherTCPclient.go contains the following code:
func main() { arguments := os.Args if len(arguments) == 1 { fmt.Println("Please provide a server:port string!") return } CONNECT := arguments[1] tcpAddr, err := net.ResolveTCPAddr("tcp4", CONNECT) if err != nil { fmt.Println("ResolveTCPAddr:", ...Read now
Unlock full access