What is the role of `flush()` in socket communication?
The `flush()` method is used to clear the buffer and prepare the data for transmission.
Thatâ€™s partially correct. It does clear the buffer, but its primary purpose is to ensure that all buffered data is sent to the client immediately.
Could you explain the difference between buffered and unbuffered streams and how `flush()` affects them?