How does a programmer treat string terminations when it comes to sending strings via an communication interface like IPC,Serial,Ethernet,...
Is it legal to just keep the string termination and hence just append multiple strings within the payload buffer?
Or is there s/t like a rule that says no you don't send string termination via an communication interface?
thanks
You do not send "strings" over those protocols in the form of as you may think about it. You send raw bytes either in textual or binary form. Think about them in Qt terms as QByteArray or QDataStream.
You will find those classes around the QIODevice class in the Qt framework which is the base class for any "IO". Then, this base class in QtCore is reimplemented in subclasses like in the QtSerialPort, QtBluetooth, QtNetwork and the like modules.
In general, your question seems to be a bit more protocol oriented, i.e. protocol design. You usually have the terminating character if it is textual data or you could even have a length field instead. The terminating character could also be anything depending on the data, so not just \0
.
For instance, the protocols we use, it is sometimes '\n', sometimes ';' and what not. It is up to you, but using a dedicated terminating character is well valid and extensively used out there, really.
Naturally, only the length field can be applied when sent in binary mode.