5 ms·
We develop Web in C++ and all our protocols looks like this: serializer.put<uint32_t>(item).put(another).put(this); if (writer.valid()) { // no overflo
by sobakistodor 5y ago
We develop Web in C++ and all our protocols looks like this:
serializer.put<uint32_t>(item).put(another).put(this);
if (writer.valid()) {
// no overflows or other problems
socketwriter.write(serializer.data());
}
Simple. Bytes. Dont care about any "protocols".
- eitland 5y agoA company I used to work for used to do something like this (I never had access to the source code, but I inspected it closely with Wireshark a time or two). Sent over UDP this had stood the test of time for a couple decades or so. Disadvantage: the rest of the system was also written in C++ and it was impossible to get those who had access to the source code and knew it to fix anything. As a result the system looked more and more antiquated and there were more and more hoops to jump through to get it working with every new version of Windows:-/ Edit: that said, I think your comment is a bit off topic :-)
- Jtsummers 5y ago> Simple. Bytes. Dont care about any "protocols". You have a protocol there, you have an understanding of what's expected on either side of that communication. That is the definition of a protocol. And if that's for Web stuffs, as you say, then you must be implementing something related to HTTP/HTTPS, protocols.
- selfhoster11 5y agoGood luck with upgrading or downgrading anything. There's a reason why people serialise to well-known formats like protobuf and JSON, and it's because they are extensible.
- southerntofu 5y agoMoreover, there's a reason why people standardize/specify their profobuf/JSON/XML schemas, and it's because that's more extensible than unversioned, unnamespaced serialized data.
- ajconway 5y agoBytes don't care about protocols, but anyone who cares about future and backwards compatibility should.
- lelanthran 5y agoserializer fixes endianess?