Whilst you can approach timing problems by adding delays, I think it can lead to a fragile solution and also a sub-optimal one (lower speed of transfer than is possible).

The link between the modem and the computer should implement flow control, where the receiver tells the sender when to stop and start sending. This is normally done either in-band (with XON/XOFF signalling - those ctrl-S and ctrl-Q ASCII characters that you can find locking up your xterms :-) or on seperate lines of the serial connection (RTS/CTS - ready-to-send, clear-to-send), which is a little better since it makes your connection 8-bit clean and doesn't take up any comms bandwidth.

See the &Kn section of the link above.

Disclaimer: I haven't done this sort of thing for a long time, but fixing timing problems with delays isn't a good idea. ( 0.1s between chars? You've just limited yourself to 10chars/second, approx 80baud :-(


In reply to Re: Lost characters using Device::Modem by jbert
in thread Lost characters using Device::Modem by shigetsu

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.