From: Ken Bloom Date: 2008-04-25T09:10:24+09:00 Subject: Re: works thro irb but not on commandline On Thu, 24 Apr 2008 13:23:28 -0700, Junkone wrote: > i have a strange prob. when i run this code under irb, the buddy can > recieve the message. when i run it under the ruby commandline, the buddy > does not recive the message. i am not sure what the difference is. > any pointers is appreciated. > > > require 'net/toc' > client = Net::TOC.new("userid","password") client.connect > client.wait(10) > friend = client.buddy_list.buddy_named("mybuddy1") client.on_im do | > message, buddy | > puts "#{buddy.screen_name}: #{message}" > end > client.on_error do | error | > puts "!! #{error}" > end > > friend.send_im(" hi how going") # not sure why this is not being > sent. > puts client.buddy_list.to_s > > client.disconnect() Try sleeping for a second after sending the message, but before disconnecting, and see if that fixes it. (Maybe it's some kind of asynchronous communication issue in net/toc.) --Ken -- Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/