Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
That's not the "every 10 seconds" called for.
How do you expect the heartbeat process to act? If the heartbeat arrives before 9.9999999999999999999999999999 seconds or after 10.00000000000000000000000001 seconds, the other end is considered dead?

Typical heartbeat implementation need to get a heartbeat within a certain timeout.

See it? The source/destination pairs are the same in both directions (Ie. for the client to server heartbeats and the server to client transfers) which makes the question of whether two local processes can use the same local port concurrently very relevant!
Sure, if you assume the server and client are the same machine. As I understand, there are 8 one-way connections:
  1. client:53036 to server:8020
  2. client:53037 to server:8019
  3. client:53038 to server:8008
  4. client:53039 to server:8003
  5. server:8020 to client:53036
  6. server:8019 to client:53037
  7. server:8008 to client:53038
  8. server:8003 to client:53039
I fail to see why that leads to two processes using the same port.
And if these are two separate processes, how will the heartbeat process know when the read process is between reads?
Why should it have to know? It's just a heartbeat. The OP didn't state such a requirement, so why should I assume one?
Use short reads with UDP and data gets thrown way.
With short reads, I mean, "don't keep reading packets until there's nothing waiting before checking the time again". I'm not assuming the OP manages to create UDP packets that are so big, it takes more than 10 seconds to read one packet.
You made two suggestions in that post, the second of which used multiple processes, with separate processes for the heartbeats and data transfers.
I wouldn't describe my second suggestion a sketch. But anyway, that suggestion uses 8 processes, each focussing on one port, all different.

In reply to Re^5: UDP connection by JavaFan
in thread UDP connection by falstad

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (6)
    As of 2020-10-29 20:10 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (274 votes). Check out past polls.