I'm trying to write a single class to support XMPP protocol, it's packets are XML nodes.
I'm using QTcpSocket for connection with the server, but sometimes when I get a big packet the readReady signal is emited twice and I get the packet fragmented. What's the best way to bypass this? I know I can have a buffer that I write all incoming data to and process the nodes when they are done, but i this the best and most optimal way? I'm quite new to Qt so it's possible I'm missing something, I'm learning new things every day.
Fragmentation with XMPP is not even half as confuing as fragmentation with a binary protocol. I'm also trying to write a class to support Gadu-Gadu (polish IM protocol) and it's packages are binary - there's always a "header" packet that tells me what type of packet I'm going to get next and what' it's size and then I get the packet, but sometimes it also get's fragmented. I haven't try to bypass this by using a buffer cause it's not easy finding out where one packet ends and another header starts.
Any help appreciated.
Bookmarks