The send system call will give you an error if it failed to send the UDP packet. I would check the return value of the send function, as you are doing, to check the status of the send system call.

Determining whether the packet was received and processed as intended at its destination is something quite different. For that I would have the receiving process return status via a return UDP packet. If you receive a reply, then you know the remote end received the packet and whether it was processed successfully or not. If you don't receive a reply, there might be a problem at the remote end, or there could be a network problem in the return path. You might resend after a timeout and repeat some reasonable number of times, after which you might assume a problem and log an error.

You may need identifiers (e.g. sequence numbers) in your messages so that status messages can be correlated with sent messages. For example, if you send two messages and receive only one reply, you might need to know which of the two messages the reply corresponds to.


In reply to Re: send call on udp socket by ig
in thread send call on udp socket by saurabh.hirani

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.