From: Tim Mcd Date: 2009-01-18T12:59:18+09:00 Subject: Ruby/tk slow threads? My code opens up a text window with an entry field. The text area gets populated with the first spurt of text from the MUD, but then doesn't update! Is my entry field not actually sending text to the server, or are the threads for receiving text from the MUD going slow? require 'tk' require 'socket' connection = TCPSocket.new("dark-legacy.com", 9898) frame = TkFrame.new.pack(:expand=>true, :fill=>:both) entry = TkEntry.new(frame).pack(:side=>:bottom, :fill=>:x) t = TkText.new(frame) do yscrollbar(TkScrollbar.new(frame).pack(:side=>:right, :fill=>:y, :expand=>false)) pack(:side=>:left, :fill=>:both, :expand=>true) end killed = false Thread.new do || begin while killed == false inp = connection.recv(100) t.insert(:end, inp).see(:end) end rescue StandardError puts $! end end entry.bind('Return') do || connection.write(entry.value) entry.delete(0, :end) end entry.focus Tk.mainloop -- Posted via http://www.ruby-forum.com/.