Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Oh dear, here we go again.

  1. send it after 9.8 seconds,

    1) That's not the "every 10 seconds" called for.

  2. Read in small chuncks ...

    To quote you "this is UDP we're talking about,".

    And to quote from the man page that you should probably review before giving your next knee-jerk response:

    If a message is too long to fit in the supplied buffer, excess bytes may be discarded depending on the type of socket the message is received

    Use short reads with UDP and data gets thrown way. Something the OP took pains to explain he cannot allow to happen.

  3. Or just use a separate process.

    And if these are two separate processes, how will the heartbeat process know when the read process is between reads?

Three ideas, that it takes just a few seconds to dismiss as unworkable.

Whether or not that's possible is irrelevant ... that is not what the OP seems to be doing. To quote him: ...

You quote only section 2 of the OPs response to my questions.

Selective amnesia; or did ADHD kick in before you got to section 3?

Let's quote him a little more:

2) The client sends the first heartbeat from ports: 53036, 53037, 53038, 53039 to ports 8020, 8019, 8008, 8003. This repeats in every 10 seconds.

3) When server receives them replies from ports 8020, 8019, 8008, 8003 to ports 53036, 53037, 53038, 53039.

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!

Oh, and do note that in my sketch, there's just one program anyway.

You made two suggestions in that post, the second of which used multiple processes, with separate processes for the heartbeats and data transfers.

And both of which cannot possibly work for the OPs requirements as described.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?


In reply to Re^4: UDP connection by BrowserUk
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 having a coffee break in the Monastery: (5)
As of 2024-03-28 23:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found