There exist two kinds of sockets: Unix sockets and network sockets. Network sockets will be explained in Chapter 12, Network Programming, whereas Unix sockets will be briefly explained in this section. However, as the presented Go functions also work with TCP/IP sockets, you will still have to wait till Chapter 12, Network Programming, in order to fully understand them as they will not be explained here. So, this section will just present the Go code of a Unix socket client, which is a program that uses a Unix socket, which is a special Unix file, to read and write data. The name of the program will be readUNIX.go and will be presented in three parts.
The first part is the following:
package main import ( "fmt" "io" "net" "strconv" "time" )
The second part of readUNIX.go is the following...