in reply to win32::serialport buffer overflow

You could use a tied filehandle to read the continuous incoming stream. The documentation of Win32::Serialport on CPAN has a section to cover a tied filehandle.

Another observation is that your code does -
(undef, $string_in) = $ob->read(65536);
where you discarded the input size with undef. What you should do is -
my $input_string; { my ($size, $str) = $ob->read(4096); # 4k at a time $input_string .= $str; redo if ($size == 4096); # read more? }
So the idea is to keep reading the input, and append to the input string, until there is no more input.

Replies are listed 'Best First'.
Re: win32::serialport buffer overflow
by Anonymous Monk on Nov 17, 2003 at 23:27 UTC
    Doing many smaller reads instead of one large one keeps the internal buffer from overflowing and makes everything work beautifully. Thanks a lot for the help.