Need help to understand basic communication API: send, receive, ACK

  • Looks like I have a problem to understand how sending exactly works? I read the docs, examples, I created sketches for 4 nodes but I'm still not sure wether I use the function send correctly.

    The function returns boolean which according to documentation:
    Returns true if message reached the first stop on its way to destination.
    My doubts here:

    1. If I send without ACK, how does a node "knows" that the "message reached the first stop on its way" ? How to interpret the returned boolean in such case? If I get false should I repeat sending?
    2. If I want to use ACK, does the send function call blocks execution until ACK is received then it returns true? Do I need to implement receive function and handle ACK by myself?

  • Mod

    @michał-kozak ack is a complex topic. See for an earlier discussion on the same topic.

    To answer your questions:

    1. The next-hop node will acknowledge the message. The returned boolean shows if the sending node received an acknowledgement from the next hop node. If you get false, it could be because the next hop didn't receive the message, or because the sending node didn't receive the acknowledgement. What you should do depends on what you want to happen.
    2. No, the send function will not block. Yes you need to handle the echoed message in receive().

    See also

  • @mfalkvidd that's helped me a lot to better understand what is happening during send! Thanks!

Log in to reply

Suggested Topics

  • 4
  • 9
  • 933
  • 1
  • 1
  • 2