[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

drb application in bots

Junkone

12/30/2007 6:49:00 PM

Hello.
I am doing a drb application for a bot client and have a prob. How can
i set up the server so that it will accept a string and do someaction
like bot.deliver(string)

bot server
!/usr/bin/env ruby
require 'rubygems'
require 'jabber/bot'
require 'fileutils'
require 'drb'



# Create a public Jabber::Bot
$bot = Jabber::Bot.new(
:jabber_id => 'user@email.com',
:password => 'pass',
:master => 'user1@email.com',
:is_public => true
)

Thread.new do
$bot.connect
end

puts "starting anothe rsergice"
DRb.start_service('druby://localhost:9000',
$bot.deliver("user1@email.com,somestring)
DRb.thread.join # Don't exit just yet!
puts "starting anothe service"



# Bring the new bot to life



Bot client
irb(main):013:0> obj = DRbObject.new(nil, 'druby://localhost:9000')
=> #<DRb::DRbObject:0x2e4a80c @uri="druby://localhost:9000", @ref=nil>
irb(main):014:0> obj.im("this is a true bot.")