From: Angel Marques on
Hi everybody, I'm try use eventmachine for make a simple chat client..I
did the server and works fine but now I wanna do a client, the problem
is simple, I'm very noob and I don't know how send my data to server,
actually I can receibe data using

def receive_data(data)
puts data
end

but I don't know how to send data...I've this

very simple
module Client


def post_init

send_msje
end


private
def send_msje
while 1
print "# say: "
msje=gets
puts "you say #{msje}"

send_data msje
end
end





def receive_data(data)
puts data
end
end

EventMachine::run do
EventMachine::connect "0.0.0.0", 8081, Client
end


is it good?...sorry I'm full noob and the few examples about clients
using EM only send one data to server and close the conexion, I only did
a ugly loop for keep the conexion, if someone can explain me a bit about
this I appreciate it..

sorry for my english
--
Posted via http://www.ruby-forum.com/.

From: Roger Pack on
> is it good?...sorry I'm full noob and the few examples about clients
> using EM only send one data to server and close the conexion, I only did
> a ugly loop for keep the conexion, if someone can explain me a bit about
> this I appreciate it..

If it works it's good :)
A few resources for you:
http://wiki.github.com/eventmachine/eventmachine/code-snippets
http://groups.google.com/group/eventmachine
--
Posted via http://www.ruby-forum.com/.