Displaying 3 results from an estimated 3 matches for "stop_event_loop".
2008 Jan 06
5
Having very odd problems with UDP.
...very odd problems.
This snippet of code gives the error that follows it.
class EchoServer
def receive_data data
puts data
send_data ">>>you sent: #{data}"
if data =~ /quit/i
puts "quitting"
close_connection
EventMachine::stop_event_loop
end
end
end
EventMachine::run {
EventMachine::open_datagram_socket "127.0.0.99", port, EchoServer
}
Gives the error
d:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0.8.1-x86-mswin32/lib/eventmachine.rb:959:in
`event_callback'': EventMachine::ConnectionNotBound
(EventMachi...
2007 Nov 07
4
Gracefully stopping EventMachine?
...and calls close_connection(true) so
they''ll see the message before being disconnected. The problem then becomes
getting EventMachine to quit, but not until it''s handled the output and
disconnected everyone.
I''ve tried following with EventMachine::stop and
EventMachine::stop_event_loop, both of which work at stopping the machine,
but do not output the last writes to users. Some way to tell that there''s
no one connected or no more pending traffic or the like would be great. I
finally set up a flag to stop allowing incoming connections, and after the
code to close exist...
2006 Aug 08
11
Core dump using sample DumbHttpClient
...ta
@data << data
if @data =~ /[\n][\r]*[\n]/m
puts "RECEIVED HTTP HEADER:"
$`.each {|line| puts ">>> #{line}" }
puts "Now we''ll terminate the loop, which will also close the
connection"
EventMachine::stop_event_loop
end
end
def unbind
puts "A connection has terminated"
end
end # DumbHttpClient
EventMachine::run {
EventMachine::connect "69.25.136.32", 80, DumbHttpClient
}