Implement I/O multiplexing and packet buffer