Sha256: db1dccf0a31fdb8f630f36784c64a7f9794642da4666b8d9e1f5fda1576189d7

Contents?: true

Size: 749 Bytes

Versions: 7

Compression:

Stored size: 749 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'bundler/setup'
require 'liquid/boot'
require 'zmachine'

$log.level = :debug
ZMachine.logger = $log
ZMachine.debug = true

#set_trace_func proc { |event, file, line, id, binding, classname|
#  printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
#}

class ZMQEchoServer < ZMachine::Connection
  def receive_data(buffer)
    send_data(buffer)
  end
end

class TCPEchoServer < ZMachine::Connection
  def receive_data(buffer)
    send_data(buffer)
  end
end

ZMachine.run do
  ZMachine.start_server("tcp://*:10000", ZMQ::ROUTER, ZMQEchoServer) do |handler|
    handler.channel.identity = "server"
  end
  #ZMachine.start_server("0.0.0.0", 10000, TCPEchoServer)
  puts "machine running"
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zmachine-0.4.3 examples/echo_server.rb
zmachine-0.4.2 examples/echo_server.rb
zmachine-0.4.1 examples/echo_server.rb
zmachine-0.4.0 examples/echo_server.rb
zmachine-0.3.2 examples/echo_server.rb
zmachine-0.3.0 examples/echo_server.rb
zmachine-0.2.1 echo_server.rb