Scheduler and tcp message receptions in the same thread