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. QtNetwork/QUdpSocket
Qt 6.11 is out! See what's new in the release blog

QtNetwork/QUdpSocket

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.9k 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.
  • E Offline
    E Offline
    egibert
    wrote on last edited by
    #1

    Hi.
    I am trying to make a server/client app. I have one client who send the first socket using broadcast and then the server receive the socket now I need to send a socket to the client using unicast how can I do-it if I don't have the IP of the client I only have the socket.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      Hm, you can't send socket, I think you mean "packet". You can obtain an IP and port from readDatagram() method (look in Assistant)

      1 Reply Last reply
      0
      • E Offline
        E Offline
        egibert
        wrote on last edited by
        #3

        Thanks for the replay. But only one question. How I know the port which has generated the client to send the packet to the server. Because after that the server replay to the client and I need to know the port because I need to bind the socket to that port !!

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vinb
          wrote on last edited by
          #4

          If you write both sides, you just specify the port you want to use. Otherwise, you can scan the ports on the server for the service you want to connect with.
          Servers mostly have a fixed port to connect with, regardless how many clients connect with it.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DenisKormalev
            wrote on last edited by
            #5

            Yep, best solution will be to have fixed port for receiving answers on your client side.

            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