read and write with protocol