Sha256: 6823ca994d70e266b4048694e816ae3596297ba387a9e22bfebc642778460164

Contents?: true

Size: 772 Bytes

Versions: 57

Compression:

Stored size: 772 Bytes

Contents

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

require 'rubygems'
require 'cool.io'

ADDR = '127.0.0.1'
PORT = 4321

class ClientConnection < Cool.io::TCPSocket
  def on_connect
    puts "#{remote_addr}:#{remote_port} connected"
    write "bounce this back to me"
  end

  def on_close
    puts "#{remote_addr}:#{remote_port} disconnected"
  end

  def on_read(data)
    print "got #{data}"
    close
  end

  def on_resolve_failed
    print "DNS resolve failed"
  end

  def on_connect_failed
    print "connect failed, meaning our connection to their port was rejected"
  end

end

event_loop = Cool.io::Loop.default
client = ClientConnection.connect(ADDR, PORT)
client.attach(event_loop)
puts "Echo client connecting to #{ADDR}:#{PORT}..."
event_loop.run 

Version data entries

57 entries across 57 versions & 6 rubygems

Version Path
cool.io-1.9.0 examples/echo_client.rb
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/cool.io-1.8.1/examples/echo_client.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/cool.io-1.8.1/examples/echo_client.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/cool.io-1.8.1/examples/echo_client.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/cool.io-1.8.1/examples/echo_client.rb
cool.io-1.8.0 examples/echo_client.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/cool.io-1.7.1/examples/echo_client.rb
cool.io-1.7.1-x86-mingw32 examples/echo_client.rb
cool.io-1.7.1-x64-mingw32 examples/echo_client.rb
cool.io-1.7.1 examples/echo_client.rb
cool.io-1.7.0 examples/echo_client.rb
cool.io-1.6.1 examples/echo_client.rb
cool.io-1.6.0-x64-mingw32 examples/echo_client.rb
cool.io-1.6.0-x86-mingw32 examples/echo_client.rb
cool.io-1.6.0 examples/echo_client.rb
cool.io-1.5.4-x64-mingw32 examples/echo_client.rb
cool.io-1.5.4-x86-mingw32 examples/echo_client.rb
cool.io-1.5.4 examples/echo_client.rb
cool.io-1.5.3-x86-mingw32 examples/echo_client.rb
cool.io-1.5.3-x64-mingw32 examples/echo_client.rb