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. [solved] Client/Server My tcpserver lies to me
Forum Updated to NodeBB v4.3 + New Features

[solved] Client/Server My tcpserver lies to me

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.2k 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.
  • M Offline
    M Offline
    mya_
    wrote on last edited by
    #1

    Sorry, if I placed this thread in wrong place.

    I'm writing client/server program based on this example: http://qt-project.org/doc/qt-5/qtnetwork-fortuneserver-example.html
    I have problem with finding correct IP adress of my server (second part of code in given example). After executing, variable ipAddress contains first IPv.4 adress from ipAddressesList list.
    Unfortunatly, client program (running on another computer in the same LAN network) can't connect with the server using this IP.
    However, when I use ipconfig command to find correct IP of my server and use that IP in client it's connecting fine.
    My "correct" server's IP is also on ipAddressesList list, but program never search through this list that far.

    Why server isn't honest with me and gives me wrong adress? How can I find correct adress?

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

      Hi and welcome to devnet,

      That example assumes that you are running it on a classic machine with one network interface so one address. If your server does have and use several cards then it's up to you to list all possible addresses.

      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
      • M Offline
        M Offline
        mya_
        wrote on last edited by
        #3

        Thank you for reply.

        I read about it and it looks like that addresses on the list came from different kinds of connections: wire, wireless connections and virtual machines (?).

        Thing is that I have no idea how network will be look like on computer running this application. So I'm completely blind when trying to choose correct IP.
        Can I determine, somehow, what's actual purpose of each IP from this list?

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

          What about announcing your service using zeroconf then ?

          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
          • M Offline
            M Offline
            mya_
            wrote on last edited by
            #5

            Ideal solution for me would be to just find right IP address. However zeroconf seems to be the best option.

            Thank you.

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

              That will simplify things especially if you have several interfaces.

              If that answers your question then please update the thread title prepending [solved] so other forum users may know a solution has been found :)

              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