Sha256: c88ebe760db8ab9ecb6cde3efaab0ac0071e1d5e0d6e604c6f247c24b69fac04

Contents?: true

Size: 580 Bytes

Versions: 41

Compression:

Stored size: 580 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'

spin_loop(interval: 5) { p Thread.backend.stats }

server = TCPServer.open('127.0.0.1', 1234)
puts "Pid: #{Process.pid}"
puts 'Echoing on port 1234...'
begin
  while (client = server.accept)
    spin do
      while (data = client.gets)
        # client.send("you said: #{data.chomp}!\n", 0)
        client.write('you said: ', data.chomp, "!\n")
      end
    rescue Errno::ECONNRESET
      'Connection reset...'
    ensure
      client.shutdown
      client.close
    end
  end
ensure
  server.close
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
polyphony-0.99 examples/io/echo_server.rb
polyphony-0.98 examples/io/echo_server.rb
polyphony-0.97 examples/io/echo_server.rb
polyphony-0.96 examples/io/echo_server.rb
polyphony-0.95 examples/io/echo_server.rb
polyphony-0.94 examples/io/echo_server.rb
polyphony-0.93 examples/io/echo_server.rb
polyphony-0.92 examples/io/echo_server.rb
polyphony-0.91 examples/io/echo_server.rb
polyphony-0.90 examples/io/echo_server.rb
polyphony-0.89 examples/io/echo_server.rb
polyphony-0.87 examples/io/echo_server.rb
polyphony-0.86 examples/io/echo_server.rb
polyphony-0.85 examples/io/echo_server.rb
polyphony-0.84.1 examples/io/echo_server.rb
polyphony-0.84 examples/io/echo_server.rb
polyphony-0.83 examples/io/echo_server.rb
polyphony-0.82 examples/io/echo_server.rb
polyphony-0.81.1 examples/io/echo_server.rb
polyphony-0.81 examples/io/echo_server.rb