[erlang-questions] Return status of gen_udp send

Raimo Niskanen raimo+erlang-questions@REDACTED
Mon Jun 4 10:01:07 CEST 2012


On Mon, Jun 04, 2012 at 09:33:42AM +0200, Torben Hoffmann wrote:
> You cannot make any assumptions about how often the missile hits.
> What you know for sure is that you will not be notified about the
> success or failure.
> 
> From the Wikipedia entry on UDP:
> >UDP uses a simple transmission model without implicit handshaking
> >dialogues for providing reliability, ordering, or data integrity.
> >Thus, UDP provides an unreliable service and datagrams may arrive
> >out of order, appear duplicated, or go missing without notice. UDP
> >assumes that error checking and correction is either not necessary
> >or performed in the application, avoiding the overhead of such
> >processing at the network interface level.
> So you have to think about how to deal with this.
> 
> UDP is similar to message passing in Erlang, you cannot be sure that
> a message is received, but unlike UDP, you can be sure that there

It is a bit more reliable than that. If you send 3 messages and the
first and third arrives you can be sure the second also did arrive
in between them. So messages are not lost unless the receiver
or the connection fails.

And it is possible to ensure that the receiver or the connection
can not fail silently using e.g erlang:monitor.

> are no duplicates and that messages arrive in order (but you cannot
> be guaranteed that the receiver processes them in order).
> 
> Cheers,
> __
> /orben
> 
> 
> 
> On 02/06/2012 12:24, Wojtek Narczyński wrote:
> >On 2012-06-02 09:39, Torben Hoffmann wrote:
> >>Tim, you are correct about the 'fire and forget', but that is
> >>only for the part outside your own machine.
> >
> >Really?
> >
> >I always thought that in 'fire and forget' you can forget exactly
> >because the missile is (almost) guaranteed to reach its target.
> >
> >Silly me.
> >_______________________________________________
> >erlang-questions mailing list
> >erlang-questions@REDACTED
> >http://erlang.org/mailman/listinfo/erlang-questions
> 
> -- 
> http://www.linkedin.com/in/torbenhoffmann
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list