There are many common problems that will be considered in the process:
TCP Sticky Package
- A header is placed at the beginning of each package, indicating the size of the package. Then the read function will cut the stream at the end of the packages, so that they are divided.
Blocking Threads While Waiting
- Apart from the fact that QTcpSocket is well designed and it doesn't block while waiting. TCP sockets are placed in a thread pool, which is reimplemented from Qt Library.
- Then the busy sockets are evenly distributed in every threads so that they can do their jobs efficiently.
- The code is not yet shown inside the project source code because I don't want to mess the repository up. I will include that very soon.
Compatibility Between Languages
- Qt has its own binary format, which is called QDataStream. To communicate with programs written with other frameworks or languages, text is used instead of binary.
- All the packets will be sent in JSON format for easier connection with other languages.