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. Peer to Peer Connection
QtWS25 Last Chance

Peer to Peer Connection

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 9.3k 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.
  • L Offline
    L Offline
    lorik
    wrote on last edited by
    #1

    How to establish peer to peer connection?

    From fortune examples I had learn that one App is Server that listens on some ip + port
    And the second one is a client that connecting to this specific ip and this specific port.

    Did I understand it right?

    I need peer to peer connection.

    If you have this knowledge, please, I need your help!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Why is the server client concept a problem for you?
      It is also the typical setup used when peer-to-peer comms are established. Probably most of them are realized as a server-client over tcp/ip.
      One correction the server is just listening. Typically it may accept any ip address and you might allow any port "see listen":http://doc.qt.nokia.com/4.7/qtcpserver.html#listen
      The other side has to know the ip and may use any port then. However, you could make a scanning of possible ips to where you like to connect, if your virus scanner does allow such activity.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lorik
        wrote on last edited by
        #3

        I need two sides (two app) with the same activity.

        Like windows messaging ,but platform independent and possibility to talk to each other via network

        One app sending data to the second app ,and vice versa.

        So both of them should listening (like server) and connect to each other in order to send data(messages)

        Is that means that both of them should be servers?

        (I think it should be possible form one server connect to other server...?)

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          The communication is done through QTcpSocket. Those you have on both sides.
          The concept of server and client is required for establishing the connection only. 99% or more will have to be identical for both, servers and clients, anyhow.
          I would write one application as a server, which also, through a Gui or whatever means you like, can establish a connection as client.

          Have a look to the fortune examples. After you have established the connection, try to send the information from client to server and vice versa. After the comms are established there is no difference anymore.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lorik
            wrote on last edited by
            #5

            thank you. I'll try it

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              A p2p setup is nothing more than a situation where every node in a network can act as both a server and a client. No magic involved there. It depends a bit on what you are after. Is your application limited to two nodes? Do you know the address and port where you expect each of the applications to be listening?

              A server is nothing more than an application that accepts incomming connections. Once a connection is established, both sides can be equal in functionality: data can flow both ways on a TCP connection. The only challenge you face, is to come up with a system to establish that first connection. I have used UPD broadcast messages for that in the past, but a better solution is of course to use something like Zeroconf for service registration and discovery.

              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