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. Is it necessary to give IP address while opening a socket?

Is it necessary to give IP address while opening a socket?

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

    My Program communicates with a device over UDP protocol. My maschine has multiple IP addresses, WiFi (local) and LAN (internet). The connection from my maschine to the device takes place over WiFi, The device is connected with a cable to WiFi router. I am opening a socket with WiFi IP address and port number. Is is absolutely necessary to give the correct IP address? What happens if I only give port number? Can the Operation System find the correct IP address for that communication and assign a socket WiFi IP:port?

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

      You have to provide the IP of the device you want to connect to. It doesn't matter how the target is connected to the network you need its IP.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      kahlenbergK 1 Reply Last reply
      0
      • jsulmJ jsulm

        You have to provide the IP of the device you want to connect to. It doesn't matter how the target is connected to the network you need its IP.

        kahlenbergK Offline
        kahlenbergK Offline
        kahlenberg
        wrote on last edited by kahlenberg
        #3

        @jsulm Ok, it is clear that the Destination IP should be provided, I meant my IP address, source IP. Should it also be provided or can the OS find appropriate Source IP, since I have multiple IPs?

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

          You don't need to provide the source IP.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          kahlenbergK 1 Reply Last reply
          0
          • jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Here is an example: http://doc.qt.io/qt-5/qudpsocket.html#details

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • jsulmJ jsulm

              You don't need to provide the source IP.

              kahlenbergK Offline
              kahlenbergK Offline
              kahlenberg
              wrote on last edited by
              #6

              @jsulm Ok thanks.

              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