in reply to Re: Problem handling 2 simultaneous socket streams
in thread Problem handling 2 simultaneous socket streams
Good advice. (Fav'd.)
A thread can indeed be assigned to do nothing more than sit there, parked on a blocking-read, and maybe posting the received lines to a common queue for processing if the processing that needs to be done happens to favor some serialized approach. The threads basically will consume almost-no resources other than a process-table entry somewhere in the guts of the operating system, and they permit you to use the “simple calls” to entirely avoid logical complexity. They are also in the perfect position to recognize when a connection dies, and to record statistics about the connection.