python server main loop / socket communications