I am a newbie using C++ and I have a background with Java
I am working on a simple linux server using c++ and I have a question about converting byte data.
In Java, I can use putShort, or putString in ByteBuffer and simply send the buffer over socket using byteBuffer.array()
What is the corresponding c++ code of this?
Thanks in advance.
The C++ standard library does not include networking facilities. However the famous boost libraries do include this in the form of Boost.Asio. The documentation includes several examples of use.
boost::asio::mutable_buffer or boost::asio::basic_streambuf seem similar to what you describe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With