Working version with threads listeners, needed additional socket to shut down server and change main loop to non-forever, added close main socket