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

Comment on

( #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":



  • 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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [Perl300]: Hi all
    [Perl300]: I have a quick question about the Meta CPAN

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (7)
    As of 2017-12-11 17:53 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      What programming language do you hate the most?




















      Results (310 votes). Check out past polls.

      Notices?