refactor: provide functions to read/write raw socket.