in reply to Re: Writing to serial port with a delay between each character
in thread Writing to serial port with a delay between each character

Thanks for the response. To answer your questions

1. Yes I am using Device::SerialPort. Should have mentioned that before.
2. The device does not do any flow control RTS/CTS. So that option is out
3. I could lower the baud rate, but its a significant task on the system, since it is not entirely in my control.
Thanks
  • Comment on Re^2: Writing to serial port with a delay between each character

Replies are listed 'Best First'.
Re^3: Writing to serial port with a delay between each character
by mr_mischief (Monsignor) on Apr 21, 2009 at 19:13 UTC
    You can get a count of how many characters (under Linux at least) with the TIOCOUTQ function. Search the module's docs for that. You may be able to keep from flooding the device by keeping your own buffer (which it seems you already do) and only writing when the Device::SerialPort buffer is empty.

    You might also want to look into setting the mode to 'raw', but I'm not sure if that actually bypasses buffers or not. You could also look into the write_drain method which seems to go ahead and flush the transmit buffer. You could try calling that after every character you write.

    I've only done rudimentary work with the module, and I've never had to deal with such a limited device on the other end. YMMV, but I hope some of this babbling helps.