a Medically trained Computer Scientist

Blog

Geolocation Since we obtain client’s external IP address, we can add more useful feature such as geolocation to pinpoint the address of internet connection the laptop is connected on. In this program, we use a freely available api from freegeoip.net. It can give a rough estimate of our ‘missing’ laptop location. It can’t pinpoint to the exact address, you’d need a more comprehensive IP database (which will cost you money).

Refactor You have seen how easy it is too make a server-client program in go that communicates within the same computer. Next, let us make the code more readable and streamlined. Sending back data from server to client isn’t really useful when we are building a program to locate a ‘missing’ laptop. Remove func reader(r io.Reader) function and go reader(c).
Also, variable incoming is more descriptive than just fd in server.

Introduction Socket programming was a mystery to me before I took Computer Networks in university. The first time I wrote a simple ping server, I was blown away at how simple the code really was. There are two programs, a client and a server and they communicated by TCP connection.
Recently I dabbled in golang. What is a better way to learn a new language by making some useful stuff with it?