simple tcp reading and writing