Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-06-15 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.