Could you refactor this and the TcpStream's read/write methods into global helpers? Just something like `sock_read` and `sock_write`