Fixed QTcpSocket buffer wrap around error

If packages are too long they will be cut and sent in multiple messages.
This patch adds code to circumvent the cases where messages are cut in the middle of the sequence.

Signed-off-by: Samuel Stirtzel <s.stirtzel@googlemail.com>