A long-lived background thread that blocks on readBytes() is the only reliable method. But see this comment: