All socket stream code has been pulled out into a Socket class. A variant using non blocking io has been implemented as well. The goal of that code is to handle timeouts in a reasonable manner.
For example check for a message on a short timeout, and have everything be in a good state after the timeout to call it again later.