A simple Qt client-server TCP architecture to transfer data between peers
A simple Qt client-server TCP architecture to transfer data between peers.
The Architecture is made up of 2 projects:
You can instantiate as many QTCPClient as you wish.
The protocol i've designed to enable data transferring is pretty straightforward, each message sent is made up of:
The header follows the following structure:
QString header = QString("fileType:%1, fileName:%2, fileSize:%3;")
Where:
%1
can be "attachment" or "message";%2
is "null" for messages, the correspondent fileName for attachments sent;%3
is the size of the message or the attachment sent.Many improvements could have been made during protocol design, one among many, to specify header size in the header and save up some byte during transfers, especially messages ones.
This protocol is meant to be used only for recreative purposes as it isn't compliant at all to the FTP quality standards, that we are used to, nowadays.