As you already know from the previous chapter, TCP's principal characteristic is that it is a reliable protocol. The TCP header of each packet includes the source port and destination port fields. These two fields, plus the source and destination IP addresses, are combined to uniquely identify every single TCP connection. The name of the TCP client that will be developed in this section is TCPclient.go, and it will be presented in four parts. The first part of TCPclient.go is shown in the following Go code:
package main import ( "bufio" "fmt" "net" "os" "strings" )
The second code segment of TCPclient.go is as follows:
func main() { arguments := os.Args if len(arguments) == 1 { fmt.Println("Please provide host:port.") return } ...