Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt network, server, client, what is what in QT?
QtWS25 Last Chance

Qt network, server, client, what is what in QT?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 406 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by
    #1

    Hey

    I'm doing a "pre-study" of what I need to study when it comes to QT networking for my next test project.

    The target :
    Server - listens for incoming connections
    Client - connect to server
    Authentication - pw/user/etc
    PacketObject - a data objects send between client server.
    50k incoming/outgoing connections - ranging from as simple as login requests to as compelx as sending lots of data per request.

    For password hashing (?) I can use QPasswordDigestor

    For server I believe I need TcpServer. For the client I believe I need QNetworkAccessManager ?

    The general idea from past that I used was to start a server in a thread in while loop. Then have it constantly monitor for incoming connections, if connection was made, send a request for auth data, then receive it, check if valid and if so store in array the connection and keep it live until either side disconnects. If client dies, server will get disconnect call and clean up the task that client had assigned if any.

    When it comes to qt, TcpServer seems to just have listen() and that apparently just ... runs? So no need for making new thread, moving it to it and while loops? Hmm nice? :- )

    It also has newConnection signal. Does it mean that when I get newConnection I grab the connection (QTcpSocket), send request for pw and then, wait for reply somehow & check if reply is the auth I wanted and either store connection or deny connection? I take I would store the QTcpSocket in array then if its valid ? But that would be blocking, perhaps I should see if the connection is the auth, if not, send request for auth back to QNetworkAccessManager, which would then ask for authentication ? Not sure... the QNetworkAccessManager seems to have a lot of it built in, but where do I get a matching server to it ? Or we only have 50% of the classes and the rest we have to figure out by ourselves?

    Anyway, moving on, there seem to be a QNetworkRequest which seems to be equal to my understanding of a PacketObject - esentially its a message that lets say, starts with first 4bytes being an int, that definies its type, and then message being serialized data. So server can do something like ("Terrible sudo pseudocode") requestReceived(packetObject*patcket) (int)packet[0-4]==10{processAsX(packet} ? So instead of that I can relay on QNetworkRequest ? - somehow... :- )

    Not sure... For now I'm confused with:

    QNetworkAccessManager
    QNetworkRequest
    QAuthenticator
    QNetworkReply

    and how it all fits with QTcpServer...

    Any help would be great. I'm going over qt docs/examples but they feel a little random, each having some answers that I need but at the same time using different ways of communicating...

    TIA

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you want your full implementation in Qt / C++ ? If so, then the Cutelyst project will likely be a very good base to work.

      You'll have all the basics in place without the need to re-implement everything yourself from scratch.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved