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-1.6 examples/pipes/echo_server.rb
polyphony-1.5 examples/pipes/echo_server.rb
polyphony-1.4 examples/pipes/echo_server.rb
polyphony-1.3 examples/pipes/echo_server.rb
polyphony-1.2.1 examples/pipes/echo_server.rb
polyphony-1.2 examples/pipes/echo_server.rb
polyphony-1.1.1 examples/pipes/echo_server.rb
polyphony-1.1 examples/pipes/echo_server.rb
polyphony-1.0.2 examples/pipes/echo_server.rb
polyphony-1.0.1 examples/pipes/echo_server.rb
polyphony-1.0 examples/pipes/echo_server.rb
polyphony-0.99.6 examples/pipes/echo_server.rb
polyphony-0.99.5 examples/pipes/echo_server.rb
polyphony-0.99.4 examples/pipes/echo_server.rb
polyphony-0.99.3 examples/pipes/echo_server.rb
polyphony-0.99.2 examples/pipes/echo_server.rb
polyphony-0.99.1 examples/pipes/echo_server.rb
polyphony-0.99 examples/pipes/echo_server.rb
polyphony-0.98 examples/pipes/echo_server.rb
polyphony-0.97 examples/pipes/echo_server.rb