Copied listening socket functionality from http_server1 to http_server2