use one main loop for all connections