From: vladare@... (Vlad) Date: 2001-12-20T07:08:12+09:00 Subject: [ruby-talk:29007] Can't obtain data from Serial Port. I try to write the simple program allowing exchanging packages through Serial Port with POS Terminal. Ask to explain to me that I do incorrectly? I bring a piece � Class Serial Def wait_for_data (device) @device=open(device,"a+") # Put in POS terminal code "ENQ" @device.putc(0x05) @device.flush # Wait the answer from POS terminal select ([@device],nil,nil,0) @device.each_byte {|byte| print byte,"\n" ...... } end end serial_port='/dev/ttyS2' # Serial part ser=Serial.new serial_server=Thread.new { ser.wait_for_data(serial_port) } # Network part .... The code �ENQ� really comes in POS and it answers in Serial Port, but I can not receive it. Whether I can use here for this purpose IOCTL? If not it is difficult, write an example of use of function IOCTL c FIONREAD and TIOCMGET in parameters. Many thanks