improved socket select in session