class BuildCommClient
VERSION = "1.7.0"
- FIRST_REPONSE_TIMEOUT = 120
+ FIRST_RESPONSE_TIMEOUT = 120
private_class_method :new
begin
l = nil
- timeout(FIRST_REPONSE_TIMEOUT) do
+ timeout(FIRST_RESPONSE_TIMEOUT) do
l = @socket.gets()
end
# handle
- def read_lines
+ def read_lines(begin_timeout = nil, data_timeout = nil)
begin
# get first line
l = nil
- timeout(FIRST_REPONSE_TIMEOUT) do
+ if begin_timeout.nil? then
+ begin_timeout = FIRST_RESPONSE_TIMEOUT
+ end
+
+ timeout( begin_timeout ) do
l = @socket.gets()
end
# get contents
result = true
- while line = @socket.gets()
+ while true
+ if not data_timeout.nil? then
+ timeout( data_timeout ) do
+ line = @socket.gets()
+ end
+ else
+ line = @socket.gets()
+ end
+ if line.nil? then break end
if line.strip == "=END" then break end
if line.strip == "=CHK" then next end