Members - Reputation: 534
Posted 20 October 2012 - 11:55 AM
To fix any of those problems, copy data you want to send into single buffer, ex. array, and send it.
Moderators - Reputation: 10203
Posted 20 October 2012 - 12:21 PM
If so, treat a block of memory as a "file" and "save" it to there. Then send that block as a message over the network.
Members - Reputation: 140
Posted 21 October 2012 - 05:49 AM
std::ostringstream archive_stream; boost::archive::text_oarchive archive(archive_stream); archive << myStruct; sendto(Socket, archive_stream.str().c_str(), sizeof(archive_stream.str().c_str()), 0, (SOCKADDR *) & SockAddr, sizeof(SockAddr));but how to I receive them on the other end?
Edited by Fezziwig, 21 October 2012 - 05:50 AM.
Members - Reputation: 262
Crossbones+ - Reputation: 7019
Posted 24 October 2012 - 10:09 PM
Remember that 'serialize' is just a fancy word for 'put in a specific order'. If you hold the relevant data in your classes as a member struct then you should have an easier time serializing, since you can just grab that struct from the object.
There are ten kinds of people in this world: those who understand binary and those who don't.