TCP/IP is a common network protocol and the HTTP protocol was built on top of it. TCP requires a client to connect to a server in order to send and receive data. This recipe will use the net package to make a TCP connection between a client and a server. The client will send user input to the server and the server will respond with the same string inputted, but converted to uppercase using the results of strings.ToUpper(). The client will print any messages received from the server so it should output the uppercase version of our input.
How to do it...
These steps cover writing and running your application:
- From your Terminal or console application, create a new directory called~/projects/go-programming-cookbook/chapter5/tcpand navigate to this directory.
- Run the following command:
$ go mod init github.com/PacktPublishing/Go-Programming-Cookbook-Second-Edition/chapter5...