As I'm learning Go, I found an Echo client/server is the next logical step after messing around with basic TCP/IP client and server programming.
go run client/client.go
go run client/client.go --help
go run server/server.go
go run server/server.go --help
A typical TCP Echo server listens for connections on TCP port 7. In this very example, I'm using 7000
so you don't have to run it as root. However, if you want to troubleshoot it against a real server, remember to change the bind/connect port using --port
flag.
Add the following lines to /etc/inetd.conf
file:
echo stream tcp nowait root internal
go run client/client.go --port 7
nc -v localhost 7000