Sha256: e76d6c586ccdc2648217d4ad4799e766d71644943675d4bf8645957da08e6e70

Contents?: true

Size: 368 Bytes

Versions: 1

Compression:

Stored size: 368 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'

def handle_client(conn)
  spin do
    buffer = Polyphony.pipe
    spin { IO.splice_to_eof(conn, buffer) }
    IO.splice_to_eof(buffer, conn)
  end
rescue SystemCallError
  # ignore
end

puts "Serving echo on port 1234..."
TCPServer.new('127.0.0.1', 1234).accept_loop { |c| handle_client(c) }

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyphony-0.91 examples/pipes/echo_server.rb