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. Clarification....is it good or not ?
Forum Updated to NodeBB v4.3 + New Features

Clarification....is it good or not ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtcpserverqtcpsocket
5 Posts 4 Posters 1.7k Views 1 Watching
  • 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.
  • billy.NB Offline
    billy.NB Offline
    billy.N
    wrote on last edited by
    #1

    Hi,
    i am realizing a little server for my tchat application
    i use the tcpServer and tcpSocket...to represent clients

    when the socket send a message to the server i would to know if i can use this code to know if the server receive all informations sent by clients before treating them :


    while (!socket.atEnd())
    {
    QByteArray data = socket.read(100);
    ....
    }


    thanks for anwsers !!!

    raven-worxR 1 Reply Last reply
    0
    • billy.NB billy.N

      Hi,
      i am realizing a little server for my tchat application
      i use the tcpServer and tcpSocket...to represent clients

      when the socket send a message to the server i would to know if i can use this code to know if the server receive all informations sent by clients before treating them :


      while (!socket.atEnd())
      {
      QByteArray data = socket.read(100);
      ....
      }


      thanks for anwsers !!!

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @billy.N
      use the bytesAvailable() method before actually consuming the data

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        Check page 363 of C++ GUI Programming with Qt 4 for an explanation on how to do this

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        0
        • billy.NB Offline
          billy.NB Offline
          billy.N
          wrote on last edited by billy.N
          #4

          @raven-worx and @VRonin thanks ....

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

            Hi,

            There's also the Chat Example that may be of use.

            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
            0

            • Login

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