In article <107Ve.97$H62.0 / newssvr23.news.prodigy.net>, Phlip wrote:
>GOTOU Yuuzou wrote:
>
>> res.body can take an IO object.
>>
>>    def do_GET(req, res)
>>      res["content-type"] = "text/plain"
>>      res.chunked = true if res.keep_alive?
>>      res.body = IO.popen("dmesg")
>
>I fear popen. I use Win32. (Not my idea.) It will try to fork, then its 
>object will throw an error because Win32 can't fork.
>
>Is there an IOstream object, like the C++ std::stringstream? All I need is 
>to call the application such that each call to .write goes out the TCP/IP 
>port.

popen was just an example. The equivalent of std::stringstream is StringIO.

require 'stringio'
def do_GET(req, res)
  res["content-type"] = "text/plain"
  res.chunked = true if res.keep_alive?
  res.body = StringIO.new(@my_big_string)
end