Sha256: 78b17b518b0e1818017757bdc131fad8a11bd9e03f0a7e6ce3f32b329f3065ce

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 Bytes

Contents

#!/usr/bin/env ruby

require "rubygems"
require "bundler/setup"
require "celluloid/io"

class EchoClient
  include Celluloid::IO

  def initialize(host, port)
    puts "*** Connecting to echo server on #{host}:#{port}"

    # This is actually creating a Celluloid::IO::TCPSocket
    @socket = TCPSocket.new(host, port)
  end

  def echo(s)
    @socket.write(s)
    @socket.readpartial(4096)
  end
end

client = EchoClient.new("127.0.0.1", 1234)
puts client.echo("TEST FOR ECHO")

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
celluloid-io-0.17.3 examples/echo_client.rb
celluloid-io-0.17.2 examples/echo_client.rb