replace tcp_server_loop with more pragmatic method