Sockets joins contents!
General and Desktop
3
Posts
3
Posters
764
Views
1
Watching
-
Hello friends.
When I use two socket->write() immediately in the sender side, the receiver side receives mix of 2 content!
For exampleIn the sender side:
@
...
socket->write("sth1");
socket->write("sth2");
...
@In the receiver side I received "sth1sth1"!
But I want to receives "sth1" & "sth2" separately.I need to this approach of sending contents.
How can I do it?
Tanks a lot.
Ya Ali. -
Hi,
Try to "flush":http://qt-project.org/doc/qt-5/qabstractsocket.html#flush the buffered data after the first write.
-
Hi,
Using write like this, you get the correct result. If you want to get "sth1" and "sth2" as two different things you need to separate them using e.g. \n