【发布时间】:2015-08-23 16:37:37
【问题描述】:
如何使用 TCPSocket 多次发送和接收数据?
require 'socket'
TCPSocket.open("example.com", 80) {|s|
s.send "GET / HTTP/1.0\r\n\r\n", 0
puts s.read
s.send "GET / HTTP/1.0\r\n\r\n", 0
# Here is no data. PS: Without reconnect.
puts s.read
}
我搜索了但没有找到答案。
【问题讨论】: