Oh dear, here we go again.
send it after 9.8 seconds,
1) That's not the "every 10 seconds" called for.
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.
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".
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- 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
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||