# Ruby-serialport dropped bytes

**URL:** <https://www.ruby-forum.com/t/ruby-serialport-dropped-bytes/119437>\
**Category:** Ruby\
**Created:** [November 7, 2007, 12:34am UTC](https://www.ruby-forum.com/t/ruby-serialport-dropped-bytes/119437 "2007-11-07T00:34:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 7, 2007, 12:34am UTC](https://www.ruby-forum.com/t/ruby-serialport-dropped-bytes/119437/1 "2007-11-07T00:34:14Z")

</div>

I am using ruby-serial port version 0.6 with cygwin on Windows XP.  
The version of ruby is 1.8.5. With the test script miniterm.rb  
supplied with ruby serial port the first 10 or so bytes are lost when  
they are received. Any ideas anyone? The miniterm.rb script is:

if ARGV.size \< 4  
STDERR.print \<\<EOF  
Usage: ruby #{$0} num\_port bps nbits stopb  
EOF  
exit(1)  
end

sp = SerialPort.new(ARGV[0].to\_i, ARGV[1].to\_i, ARGV[2].to\_i,  
ARGV[3].to\_i, SerialPort::NONE)

open("/dev/tty", “r+”) { |tty|  
tty.sync = true  
Thread.new {  
while true do  
tty.printf("%c", sp.getc)  
end  
}  
while (l = tty.gets) do  
sp.write(l.sub("\n", “\r”))  
end  
}

sp.close

Mark
