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. Client 2 client communication
Qt 6.11 is out! See what's new in the release blog

Client 2 client communication

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.8k 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.
  • X Offline
    X Offline
    xjaros1
    wrote on last edited by
    #1

    Hello everybody,

    I have a theoretically oriented question. I have a client-server architecture and I want to establish a communication between clients directly (I expect big amount of data). What would you recommend to use? How would you solve this problem, because I've tried a lot of possibilities in Qt and none was successfull. I'm intrested mostly in some general advice, how to establish connection, what informations do I want to exchange due to private addresses and NAT (If my clients had public addresses, than I would use a static port number instead)

    Thank you for any advices
    Miroslav Jaros

    PS: please excuse my english, I'm not a english speaking person

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      Your "clients", are they running on the same computer?

      If so, have a look at QSharedMemory and QSystemSemaphore classes!

      Otherwise, the QtNetwork module is your friend...

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xjaros1
        wrote on last edited by
        #3

        Hello,

        No they are not, I didn't made myself clear, I'm writing a network application, and I'm already using QtNetwork module, the Client->Server communication works well, because the server has a public address, but I want to establish a network communication between clients, and I don't know what informations do I need to establish connection between them using a server. (meaning TCP connection)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          Well, usually one Client opens a Socket and "listens" for incoming connection, then the other Client can connect to that Socket. For this, the second Client needs to know the IP-Address (or DNS-Name) of the first Client as well as the Port-Number where the first Client is listening.

          If you want your Clients to connect with the help of a Server, the Server must have a known IP-Address (DNS-Name) and it must be listening on a known Port-Number. Then both Clients can connect to that Server. Now the Server can maintain a DB where it keeps the info (IP-Address + Port Number) of each Client. It can also forward that info the all other Clients on request, so Clients can now make direct connections, as described in first paragraph.

          NOTE: If any of the Clients is behind a NAT router, that Client cannot accept incoming connections, except by re-configuring the NAT router ("Port Forwarding" aka "Virtual Server"). But it can still connect to another Client that is listening (i.e. one side is not behind a NAT router). If both Clients are behind a NAT router, you need to use tricks like "TURN":http://en.wikipedia.org/wiki/Traversal_Using_Relays_around_NAT.

          See also:
          [url]http://qt-project.org/doc/qt-5.0/qtnetwork/examples-network.html[/url]

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          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