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. UDP Socket with Acknowlegment
Forum Updated to NodeBB v4.3 + New Features

UDP Socket with Acknowlegment

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.8k 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.
  • F Offline
    F Offline
    fouffa89
    wrote on 15 May 2013, 10:36 last edited by
    #1

    Hi everybody,

    my problem is with UDP Socket , I have two methods broadcastDatagram(send message to server) and ProcessPendingDatagram (receive message from server)

    the problem is that the server must send an acknowlegment when he receive a message sent by a sender.

    I send message in a loop instruction(for) because I have so many message to be sent. Server can't respond to all my messages, he send me an acknowlegment for only the last one.

    I must prevent Sender from sending a message until he got acknowlegement from server.

    I tried Sleep(ms) but it seems to block receiving message as well.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 15 May 2013, 11:13 last edited by
      #2

      Hi,

      I would use a queue. Send one message, when you receive the answer (I would assume in a slot), take the following message from the queue and send it until it's empty.

      Hope it helps

      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
      • T Offline
        T Offline
        tobias.hunger
        wrote on 15 May 2013, 12:03 last edited by
        #3

        There is nothing in the UDP protocol to make sure packages are actually received by the intended recipient.

        So what happens when a package is lost? Will you never ever talk to the server again then?

        Your requirement sounds like you really want to use TCP... that makes sure no packages are lost for you and the cool thing is you get that without having to write code yourself:)

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fouffa89
          wrote on 15 May 2013, 15:42 last edited by
          #4

          I must use UDP socket because it is a protocol specification ,in my case I send an Order (Read or modify the value of a parameter contained in the server memory) , the server must send a response (an acknowledgement to be sure that the order was received and the result of the ordre execution)

          that's why I need to be sure that I receive reponse to send another Order. Sorry for my english :(

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on 16 May 2013, 16:27 last edited by
            #5

            Autsch...

            If it matters whether requests and acknowledgements are lost, then you have to implement logic to handle lost packages. That makes the whole thing a really interesting task.

            1 Reply Last reply
            0

            3/5

            15 May 2013, 12:03

            • Login

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