Passing tcp session via pipes to fork

is it possible to pass tcp session via pipes to forked ruby process ? here is the code i am trying
and it seems to not work (browser keeps waiting for response but response never comes)

code ->

    require 'socket'
    server = TCPServer.new "0.0.0.0" , 5678

    reader , writer = IO.pipe

    fork do
      loop do
      session = reader.read
      session.puts "Hello world! The time is #{Time.now}"
      puts server.class
      session.close
      end  
    end


while session = server.accept
  writer.write session
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs