Better error handling, and ReceiveLoop no longer sleeps, but instead blocks for data.