Net::Telnet doesnt work but command line telnet does

I am making a simple remote control to vlc and running into troubles on
ubuntu. This all works in windows however but not in ubuntu. I have no
idea what could be different. When I use net/telnet I get a connection
refused but if I use telnet everything works fine.

with ruby:

irb(main):004:0> telet = Net::Telnet.new(“Host” => “localhost”, “Port”
=> 4444, “Prompt” => //)
Errno::ECONNREFUSED: Connection refused - connect(2)
from /usr/lib/ruby/1.8/net/telnet.rb:352:in initialize' from /usr/lib/ruby/1.8/net/telnet.rb:352:inopen’
from /usr/lib/ruby/1.8/net/telnet.rb:352:in initialize' from /usr/lib/ruby/1.8/timeout.rb:67:intimeout’
from /usr/lib/ruby/1.8/timeout.rb:101:in timeout' from /usr/lib/ruby/1.8/net/telnet.rb:351:ininitialize’
from (irb):4:in `new’
from (irb):4
from :0

with commandline:

telnet localhost 4444
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
VLC media player 1.1.9 The Luggage
Remote control interface initialized. Type `help’ for help.

to test as well, I run vlc with this

vlc --extraintf rc --rc-host=localhost:4444

If anyne can help I would appreciate it greatly

On Sep 19, 2011, at 16:14 , Tim A. wrote:

from (irb):4
from :0

with commandline:

telnet localhost 4444
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
VLC media player 1.1.9 The Luggage
Remote control interface initialized. Type `help’ for help.

I’m just guessing… but that “Trying ::1” line hints that
/usr/bin/telnet is trying both ipv4 and ipv6 and I’d bet dollars to
donuts that net/telnet is only trying ipv4. You can probably confirm
with ‘netstat -an | grep 4444.*LISTEN’

Ryan D. wrote in post #1022824:

On Sep 19, 2011, at 16:14 , Tim A. wrote:

from (irb):4
from :0

with commandline:

telnet localhost 4444
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
VLC media player 1.1.9 The Luggage
Remote control interface initialized. Type `help’ for help.

I’m just guessing… but that “Trying ::1” line hints that
/usr/bin/telnet is trying both ipv4 and ipv6 and I’d bet dollars to
donuts that net/telnet is only trying ipv4. You can probably confirm
with ‘netstat -an | grep 4444.*LISTEN’

it seems you are right

netstat -an | grep 4444.LISTEN
tcp6 0 0 ::1:4444 :::

LISTEN

so I checked my hosts file and sure enough it had ::1 as localhost so I
made it as 127.0.0.1 and poof that solved it all

thanks it didn’t even occur to me that the ::1 was ipv6

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs