Close the stream.
void close();
The other end of the connection will see error::eof after reading all the remaining data.
error::eof