# Telnet issue

**URL:** <https://www.ruby-forum.com/t/telnet-issue/110212>\
**Category:** Ruby\
**Created:** [July 24, 2007, 9:13am UTC](https://www.ruby-forum.com/t/telnet-issue/110212 "2007-07-24T09:13:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [July 24, 2007, 9:13am UTC](https://www.ruby-forum.com/t/telnet-issue/110212/1 "2007-07-24T09:13:40Z")

</div>

hi guys,  
I’ve got issue with following:  
#########################################################  
begin

```
t.cmd('String' => "echo -e '#{buffer}' > #{data['cfgwlan']}.tmp",

```

‘Timeout’ =\> 10, ‘Match’ =\> “#{data[‘match’]}”)

rescue TimeoutError, Timeout::Error =\> e  
myLogger.error("#{ **FILE** } #{ **LINE** } Exception:  
#{e.backtrace.join()}")  
end #begin  
#########################################################  
buffer - is a string  
data[‘cfgwlan’] - is file path with file\_name  
t - is telnet object and works correctly with other commands.

But in this case t.cmd causes Timeout::Error exception all the time but  
data[‘cfgwlan’] is each time is overwritten correctly. Looks like that  
after  
echo -e ‘#{buffer}’ \> #{data[‘cfgwlan’]}.tmp none of prompt has been  
appearing and the command ends on timeout.

What is wrong with it?

Any help would be helpful.  
Thanks in advance.  
MT

---

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [July 24, 2007, 10:20am UTC](https://www.ruby-forum.com/t/telnet-issue/110212/2 "2007-07-24T10:20:05Z")

</div>

On 7/24/07, Marcin T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
Well I can reproduce your problem, but as I have no idea what is in  
buffer it is difficult to tell what really is your problem.

buffer=“$( sleep 20 )”

are things in buffer complex enough to cause that kind of problem?  
You really need to tell us what is in buffer when it blocks I am afraid.

Cheers  
Robert

---

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [July 24, 2007, 10:37am UTC](https://www.ruby-forum.com/t/telnet-issue/110212/3 "2007-07-24T10:37:30Z")

</div>

Robert D. wrote:

> On 7/24/07, Marcin T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
> Well I can reproduce your problem, but as I have no idea what is in  
> buffer it is difficult to tell what really is your problem.
> 
> buffer=“$( sleep 20 )”
> 
> are things in buffer complex enough to cause that kind of problem?  
> You really need to tell us what is in buffer when it blocks I am afraid.
> 
> Cheers  
> Robert

My stupid fault. In place of “#{data[‘match’]}”… should be Regexp  
object not string. This is why it didn’t work. Now it is ok.
