D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
td-agent
/
embedded
/
lib
/
ruby
/
gems
/
2.1.0
/
gems
/
httpclient-2.8.2.4
/
sample
/
Filename :
stream.rb
back
Copy
$:.unshift(File.join('..', 'lib')) require "httpclient" c = HTTPClient.new piper, pipew = IO.pipe conn = c.post_async("http://localhost:8080/stream", piper) Thread.new do res = conn.pop while str = res.content.read(10) p str end end p "type here" while line = STDIN.gets pipew << line end pipew.close sleep 5