I am building a fairly complex client-server system, so I would like to be able to apply multithreading, say, on the client, send heartbeat on one stream, and send a command to the server on another stream, while using only one socket. But is this a normal solution?
To begin, let me explain what kind of confusion I am talking about.
So, pseudocode is what I send:
send("123456"); // Поток 1 send("ABCDEF"); // Поток 2 I know that in the end this can come to the receiving party:
ABCDEF 123456 That is, I understand that the order of the messages that I send may be confused .
When I tried to create a lot of threads, I watched this , so it really is.
And I'm not afraid of that.
But one person on the forum, if I understood him correctly, claims that everything is still worse.
He says that the bytes themselves in messages may be confused , that is, it can come like this:
ABC45F 123DE6 Is it true?
When I tried to create a lot of threads, I did NOT observe this , there were many messages, but in none of them the bytes were mixed with the bytes from other messages.
But I will not hope at random, so just in case I ask.
Operating system :
Windows, different versions and bitness, but only Windows, both on the server and on the clients.