Sha256: a3c8a39218e7b93f42efd84a9eee534b1810f5d0b6f62eb5fa0601933f85f348
Contents?: true
Size: 595 Bytes
Versions: 14
Compression:
Stored size: 595 Bytes
Contents
# frozen_string_literal: true require 'bundler/setup' require 'tipi' ::Exception.__disable_sanitized_backtrace__ = true opts = { reuse_addr: true, reuse_port: true, dont_linger: true } server = Tipi.listen('0.0.0.0', 1234, opts) child_pids = [] 8.times do pid = Polyphony.fork do puts "forked pid: #{Process.pid}" server.each do |req| req.respond("Hello world! from pid: #{Process.pid}\n") end rescue Interrupt end child_pids << pid end puts 'Listening on port 1234' trap('SIGINT') { exit! } child_pids.each { |pid| Thread.current.backend.waitpid(pid) }
Version data entries
14 entries across 14 versions & 1 rubygems