Sha256: 9742da4300c648eed79f12fb84735e230efcda21740e7ef98b1f8d9e494d877d

Contents?: true

Size: 550 Bytes

Versions: 14

Compression:

Stored size: 550 Bytes

Contents

require 'bundler/setup'
require 'celluloid/io'

class EchoUNIXClient
  include Celluloid::IO
  finalizer :finalize

  def initialize(socket_path)
    puts "*** connecting to #{socket_path}"
    @socket_path = socket_path
    @socket = UNIXSocket.open(socket_path)
  end

  def echo(msg)
    puts "*** send to server: '#{msg}'"
    @socket.puts(msg)
    data = @socket.readline.chomp
    puts "*** server unswer '#{data}'"
    data
  end

  def finalize
    @socket.close if @socket
  end

end

c = EchoUNIXClient.new("/tmp/sock_test")
c.echo("DATA")

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
celluloid-io-0.17.1 examples/echo_unix_client.rb
celluloid-io-0.17.0 examples/echo_unix_client.rb
celluloid-io-0.16.5.pre0 examples/echo_unix_client.rb
celluloid-io-0.16.2 examples/echo_unix_client.rb
celluloid-io-0.16.1 examples/echo_unix_client.rb
celluloid-io-0.16.0 examples/echo_unix_client.rb
celluloid-io-0.16.0.pre2 examples/echo_unix_client.rb
celluloid-io-0.16.0.pre examples/echo_unix_client.rb
celluloid-io-0.15.0 examples/echo_unix_client.rb
celluloid-io-0.15.0.pre2 examples/echo_unix_client.rb
celluloid-io-0.15.0.pre examples/echo_unix_client.rb
celluloid-io-0.14.1 examples/echo_unix_client.rb
celluloid-io-0.14.0 examples/echo_unix_client.rb
celluloid-io-0.14.0.pre examples/echo_unix_client.rb