[solved] Client/Server My tcpserver lies to me
-
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?
-
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.
-
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? -
What about announcing your service using zeroconf then ?
-
Ideal solution for me would be to just find right IP address. However zeroconf seems to be the best option.
Thank you.
-
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 :)