From: Brian Candler Date: 2010-01-27T16:40:58+09:00 Subject: Re: Problems with Telnet Sean Warburton wrote: > Thanks Brian, that was it, it was waiting for a full stop! Remember that "Match"=>/./ means "match any single character"; "Match"=>/\./ means "match a full stop" Looking at /usr/lib/ruby/1.8/net/telnet.rb on my system, I see that the default prompt is /[$%#>] \z/. That is, by default cmd() will collect response characters until it sees one of those four characters followed by a space and nothing else following (or until the far side disconnects, which is what was happening when you stuffed 'exit' into the command stream, or until a timeout occurs) I haven't seen the protocol you're using, but maybe it isn't really telnet, it's just a raw TCP socket. In that case you could use TCPSocket.open(...) and the 'expect' library (/usr/lib/ruby/1.8/expect.rb on my system) to wait for responses. -- Posted via http://www.ruby-forum.com/.