Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to connect tcp socket to current wlan ip address on run time??

How to connect tcp socket to current wlan ip address on run time??

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 430 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.
  • R Offline
    R Offline
    Ronak5
    wrote on last edited by Ronak5
    #1

    Hello,

    Since, the wlan ip adreess keeps changing based on network connected.
    Is there a way in QT where I can dynamically read current internet connected ip address and connect my tcp socket to same.

    So on server side, I have server->listen(QHostAddress::Any, port) and on client side clientSocket->connectToHost(192.168.xxx, port).
    Is there anyway I can connect client socket getting current ip address and don't have to hard code it.

    aha_1980A 1 Reply Last reply
    0
    • R Ronak5

      Hello,

      Since, the wlan ip adreess keeps changing based on network connected.
      Is there a way in QT where I can dynamically read current internet connected ip address and connect my tcp socket to same.

      So on server side, I have server->listen(QHostAddress::Any, port) and on client side clientSocket->connectToHost(192.168.xxx, port).
      Is there anyway I can connect client socket getting current ip address and don't have to hard code it.

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Ronak5 said in How to connect tcp socket to current wlan ip address on run time??:

      Is there anyway I can connect client socket getting current ip address and don't have to hard code it.

      That's one of the reasons DNS was invented.

      So set up your (WLAN) router to assign names to your devices [1] and then connectToHost("yourname", port).

      Regards

      [1] most often the computers name is automatically assigned

      Qt has to stay free or it will die.

      1 Reply Last reply
      2

      • Login

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