D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
td-agent
/
embedded
/
lib
/
ruby
/
gems
/
2.1.0
/
gems
/
cool.io-1.5.1
/
examples
/
Filename :
dslified_echo_server.rb
back
Copy
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'rubygems' require 'cool.io' ADDR = '127.0.0.1' PORT = 4321 cool.io.server ADDR, PORT do on_connect do puts "#{remote_addr}:#{remote_port} connected" end on_close do puts "#{remote_addr}:#{remote_port} disconnected" end on_read do |data| write data end end puts "Echo server listening on #{ADDR}:#{PORT}" cool.io.run