I'm trying to make a simple chatroom for 2 users in the same local network. The idea is one of them can be a host and other one a client here is a little example
server.rb:
class ChatSerwer
def chat( msg)
puts msg;
end
def ChatSerwer.Run
$SAFE=1;
@@server = LogSerwer.new
DRb.start_service('druby://localhost:9000', @@server)
DRb.thread.join
end
end
ChatSerwer.Run
client.rb:
$ip='192.168.1.110'
obj = DRbObject.new_with_uri($ip)
msg=''
while msg!='exit'
if obj.respond_to?('chat')
print "Messege:";msg=gets.chop
obj.chat(msg);
end
end
But is there a way to send meesege to a client as server ?