async reading and writing to socket