Sha256: 9e17cfdd7e1c66f0e2d23323cac5e296c740e7f52681c4bc1cbbf9d4106db277
Contents?: true
Size: 550 Bytes
Versions: 57
Compression:
Stored size: 550 Bytes
Contents
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'rubygems' require 'cool.io' ADDR = '127.0.0.1' PORT = 4321 class EchoServerConnection < Cool.io::TCPSocket def on_connect puts "#{remote_addr}:#{remote_port} connected" end def on_close puts "#{remote_addr}:#{remote_port} disconnected" end def on_read(data) write data end end event_loop = Cool.io::Loop.default Cool.io::TCPServer.new(ADDR, PORT, EchoServerConnection).attach(event_loop) puts "Echo server listening on #{ADDR}:#{PORT}" event_loop.run
Version data entries
57 entries across 57 versions & 6 rubygems