In C you have one choice (printf), but that choice may not fit your needs.
There are 2 buffers (RX one and TX one, both of 'reasonable' size) (it's the effing echo-server, nothing more)
* print content of RX-buffer, ommiting terminating '\n' ('\n' is the 'end of request') to (log/journal file)/stdout/
* ouptut received 'message' back to client, _with_ terminating '\n'