Add buffering function with timeout support

Useful to know and wait for data on the wire