Sha256: 82a7daf51d8a18e470bdadd0f1901bb658fce93c7768f1725cbc9d4a3edb8538

Contents?: true

Size: 527 Bytes

Versions: 4

Compression:

Stored size: 527 Bytes

Contents

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

class EchoUNIXClient
  include Celluloid::IO

  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

4 entries across 4 versions & 1 rubygems

Version Path
celluloid-io-0.13.1 examples/echo_unix_client.rb
celluloid-io-0.13.0 examples/echo_unix_client.rb
celluloid-io-0.13.0.pre2 examples/echo_unix_client.rb
celluloid-io-0.13.0.pre examples/echo_unix_client.rb