tut from http://codebase.eu/tutorial/linux-socket-programming-c/