#!/usr/bin/ruby -w =begin This demonstrates a problem with Net::Telnet. If the \r\n line terminator is split between the end of one TCP segment and the beginning of the next, then it is not translated to \n properly, and so /...$/ fails to match within the string. =end require 'net/telnet' host = '172.31.131.190' # INSERT SERVER IP ADDRESS HERE c = Net::Telnet.new( 'Host' => host, 'Port' => 12345 ) response = c.waitfor(/DONE/) raise "Mismatch?? #{response.inspect}" unless response =~ /6789$/ puts "All seems OK"