Might you be able to provide a reason or two as to why the fixed-length method would not be a good route to go? All communication will be a simple "this command" to handle "this data". I'd like to hear why it's a bad idea (or maybe just not the best).

Well, I was looking at it in the context of your example which seems to want to support direct access via telnet. Typing 09text_data0016example_password seemed painful. I see I may have misread your intentions though.

Just the same, specifying a fixed number of digits for the data size does seem brittle. If you ever find yourself needing to support chunks of data with more 10,000 or more characters you'll have to change a bunch of code.

Other than that, it's really fine. It makes a tradeoff between the need to know the length of your data before you send it and the need to process the stream looking for delimiters.

I'd really suggest trying to use an existing protocol if possible though. It could save you a lot of time by allowing you to use modules which are already available and have been extensively used and tested.

-sauoq
"My two cents aren't worth a dime.";

In reply to Re: Re: Choosing a client/server protocol by sauoq
in thread Choosing a client/server protocol by Coruscate

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.