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.80 examples/io/echo_server.rb
polyphony-0.79 examples/io/echo_server.rb
polyphony-0.78 examples/io/echo_server.rb
polyphony-0.77 examples/io/echo_server.rb
polyphony-0.76 examples/io/echo_server.rb
polyphony-0.75 examples/io/echo_server.rb
polyphony-0.74 examples/io/echo_server.rb
polyphony-0.73.1 examples/io/echo_server.rb
polyphony-0.73 examples/io/echo_server.rb
polyphony-0.72 examples/io/echo_server.rb
polyphony-0.71 examples/io/echo_server.rb
polyphony-0.70 examples/io/echo_server.rb
polyphony-0.69 examples/io/echo_server.rb
polyphony-0.68 examples/io/echo_server.rb
polyphony-0.67 examples/io/echo_server.rb
polyphony-0.66 examples/io/echo_server.rb
polyphony-0.65 examples/io/echo_server.rb
polyphony-0.64 examples/io/echo_server.rb
polyphony-0.63 examples/io/echo_server.rb
polyphony-0.62 examples/io/echo_server.rb