From: "ara.t.howard" Date: 2008-07-09T03:16:41+09:00 Subject: Re: Threads: Different behavior under Linux and Windows On Jul 8, 2008, at 11:59 AM, Armin Armbruster wrote: > So now I'm stuck. Here's what I really want to do, maybe someone can > show me a solution to this? > I'd like to write a little terminal application. > > 1. Open a serial port > 2. Create a sender task that waits for user input on stdin and sends > the > data out the serial port. > 3. Create a receiver task that waits for data coming from the serial > port and output it on the screen. > > Any suggestions? > > Thanks, > Armin seems like a class case of using select? if select( [stdin, serial], nil, nil, 0.2 ) ... steve shreeve has had some luck using this paradigm: require 'socket' def socketpair if RUBY_PLATFORM.include?("win32") listen = TCPServer.new('127.0.0.1', 0) client = TCPSocket.new('127.0.0.1', listen.addr[1]) server = listen.accept and listen.close [client, server] else UNIXSocket.socketpair end end c,s = socketpair require 'win32/process' info = Process.create( 'app_name' => 'cmd /c "type d:\four_megs.txt & pause"', 'startup_info' => { 'stdin' => c, 'stdout' => c, } ) c.close # needed? to get nonblocking (in a thread) io on windows. regards. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama