Sha256: 40988903abd185afb53763b52b9ec39d0db63a2641b4591c04503e550d076a39

Contents?: true

Size: 422 Bytes

Versions: 2

Compression:

Stored size: 422 Bytes

Contents

module Kamerling module Server class TCP < Sock
  private

  def handle_connection socket
    client_addr = Addr[*socket.remote_address.ip_unpack, :TCP]
    input       = socket.read
    handle input, client_addr
  ensure
    socket.close
  end

  def run_loop
    Socket.tcp_server_loop(*addr) { |socket| handle_connection socket }
  end

  def wait_till_started
    loop { break if addr.connectable? }
  end
end end end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kamerling-0.0.2 lib/kamerling/server/tcp.rb
kamerling-0.0.1 lib/kamerling/server/tcp.rb