Tcp sockets question
-
If I have a socket called sock and I want to send two different messages to a client
like so :
sock->write(message1);
sock->write(message2);, in my clients slot ready_read() , I will get the messages all in one i.e. the data I read
will be message1 and message2 concatenated .But what I really want is for readyRead() to be called twice so I can handle the messages separately .
How can I do this or what is the standard procedure ? Maybe only way is for client to receive one message at a time
and inform the server that it is ready for the next message ? -
If both messages are sufficiently small they will be send in one package. The TCP/IP packaging is done internally, so it would be best to define a sort of message interface (using SOAP, XML, ...). This also has the benefit that you can create and parse the messages by using available tools that use your message interface definition file (xml from xsd, soap xml from wsdl, ...)