Avoid busy loop when receiving incoming stream data.

Checking whether bytes are available is a non-blocking operation,
causing the receive loop to become a busy loop.

The busy loop essentially takes up a full cpu 100% of the time.

Perhaps this should be tied to a blocking setting?