Sha256: 9dfe381668f83f474f7864e0f6db09cc7f4384b961aead90814986bd58f46953

Contents?: true

Size: 444 Bytes

Versions: 23

Compression:

Stored size: 444 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'

def handle_client(conn)
  spin do
    IO.double_splice(conn, conn)
    # buffer = Polyphony.pipe
    # spin { IO.splice(conn, buffer, -1000) }
    # IO.splice(buffer, conn, -1000)
  rescue SystemCallError
    # ignore
  ensure
    conn.close rescue nil
  end
end

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

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
polyphony-0.96 examples/pipes/echo_server.rb
polyphony-0.95 examples/pipes/echo_server.rb
polyphony-0.94 examples/pipes/echo_server.rb