Sha256: a076e27d8615744cb0b00dd75b525558e46da5708b00e6c32a108582ed63eb26
Contents?: true
Size: 654 Bytes
Versions: 2
Compression:
Stored size: 654 Bytes
Contents
lib = File.expand_path('../../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rbuv' puts "Rbuv version #{Rbuv::VERSION}" clients = [] Rbuv.run do signal = Rbuv::Signal.new server = Rbuv::Tcp.new signal.start Rbuv::Signal::INT do clients.each(&:close) signal.close server.close end server.bind "127.0.0.1", 1234 server.listen 10 do client = Rbuv::Tcp.new server.accept client clients << client client.read_start do |data, error| if error client.close clients.delete client else client.write data end end end end puts "Stopped!"
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rbuv-0.0.5 | examples/echo_server_tcp.rb |
rbuv-0.0.4 | examples/echo_server_tcp.rb |