Split client message reading and writing functions