Hi,

When you send messages across a network, they get chopped up into pieces. The problem is: you cannot know ahead of time how many pieces the message will get chopped up into. Therefore, the only way to know when to stop trying to read the bits and pieces of the messages coming across the network is if there is some kind of "end of message" marker.

Some other "end of message" markers are: If the other side of the connection is always guaranteed to send messages of the same length, you can stop reading after receiving x number of bytes. Or, if the other side always uses the first two bytes of the message to indicate how many bytes the message length is, you can read the first two bytes, then read the next x number of bytes after that and then stop reading. Or, if the other side always closes the connection after sending a message, you can use that event as an end of message marker.

But the bottom line is you can't automatically detect when to stop reading because you can't know ahead of time how many pieces your message got chopped up into when it was sent across the network.

I hope that helps shed some light on the situation.


In reply to Re^3: How can I determine the server is waiting for input in POE::Wheel::ReadWrite? by 7stud
in thread How can I determine the server is waiting for input in POE::Wheel::ReadWrite? by woosley

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, details, 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, summary, 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.