fixes to make the code compile
add protocol handler
buffered read and write
add io handler