write results output stream.

* separate function to format response object.
* write results in target output stream.
* add the sendtime of request to result message.