echo server example and starting to implement socket autoclose