QLocalSocket separate multiple messages
-
wrote on 13 Jun 2022, 14:00 last edited by
Hi. I use QLocalSocket in windows. Named pipes in WIndows can send separate messages except raw byte array. Is QLocalSocket have something like this? Or maybe is Qt have classes for pack/unpack separate msg with different size to byte array?
-
Hi. I use QLocalSocket in windows. Named pipes in WIndows can send separate messages except raw byte array. Is QLocalSocket have something like this? Or maybe is Qt have classes for pack/unpack separate msg with different size to byte array?
wrote on 13 Jun 2022, 14:29 last edited by@Mefil
Hello and welcome.I don't really know what you have in mind. But
QLocalSocket
behaves just like a socket. It is not message-oriented, it is just a stream of bytes.You can impose whatever of your own protocol on top if you wish, e.g. precede a "message" you want to send with a byte count. If both ends are using Qt you can use
QDataStream
to "pack/unpack" structured data.
1/2