c++ - Qt TcpServer architecture -


the question architecture of server qt. example, there slot readyread() being called when socket signals readyread() if there several kind of requests can

void server::readyread() {    qstring msg = readfirstwordfromavaiabledata();    switch (msg){        case "ping":        case "get":  // , on    } } 

i wonder there other way this. guess isn't expandable , comfortable.

if want server work client written on java, c, perl, etc should use qbytearray only, right? in samples qtdemo client sends size of message before message. necessary?

it nice if suggest me samples servers written qt (on github, bitbucket, etc). want how production servers arranged.

if each of commands have fixed length of payload, may not necessary send message length.

qbytearray convenient wrapper around unsigned char array, , has useful utility methods, it's thing use. can use qstring if protocol text-based, though aware default qstring unicode, character takes 2 bytes instead of one. can use appropriate conversion functions (qstring::fromutf8, qstring::fromascii, etc.).

i first suggest taking @ examples in qt documentation if haven't done so. don't have other examples recommend though.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -