MUD client으로 텔넷을 사용하고 있습니다.em-simple_telnet.rb 오류 'pause_and_wait_for_result'
날씨가 like Apache does인데이 오류는 아마도 em-simple_telnet API을 올바르게 사용하지 않는 것으로 보입니다.
오류 :
[email protected]:~/ruby$
[email protected]:~/ruby$ ruby weather.rb
{"host"=>"rainmaker.wunderground.com", "port"=>3000}
/home/thufir/.rvm/gems/ruby-2.0.0-p247/gems/em-simple_telnet-0.0.14/lib/em-simple_telnet.rb:712:in `pause_and_wait_for_result': EventMachine::Protocols::SimpleTelnet::ConnectionFailed (EventMachine::Protocols::SimpleTelnet::ConnectionFailed)
from /home/thufir/.rvm/gems/ruby-2.0.0-p247/gems/em-simple_telnet-0.0.14/lib/em-simple_telnet.rb:246:in `connect'
from /home/thufir/.rvm/gems/ruby-2.0.0-p247/gems/em-simple_telnet-0.0.14/lib/em-simple_telnet.rb:191:in `block in new'
[email protected]:~/ruby$
코드 :
#!/usr/bin/env ruby
require 'rubygems'
require 'em-simple_telnet'
require 'yaml'
require 'pry'
require 'pp'
opts = YAML.load_file('params.yml')
pp opts
EM::P::SimpleTelnet.new(opts) do |host|
puts host.cmd("ls -la")
end
여기 날씨 서비스를 텔넷 세션의 :
[email protected]:~/ruby$
[email protected]:~/ruby$
[email protected]:~/ruby$ telnet rainmaker.wunderground.com 3000
Trying 38.102.137.140...
Connected to rainmaker.wunderground.com.
Escape character is '^]'.
------------------------------------------------------------------------------
* Welcome to THE WEATHER UNDERGROUND telnet service! *
------------------------------------------------------------------------------
* *
* National Weather Service information provided by Alden Electronics, Inc. *
* and updated each minute as reports come in over our data feed. *
* *
* **Note: If you cannot get past this opening screen, you must use a *
* different version of the "telnet" program--some of the ones for IBM *
* compatible PC's have a bug that prevents proper connection. *
* *
* comments: [email protected] *
------------------------------------------------------------------------------
Press Return to continue:
Press Return for menu
or enter 3 letter forecast city code-- dca
Weather Conditions at 12:27 AM EDT on 29 Aug 2013 for Washington, DC.
Temp(F) Humidity(%) Wind(mph) Pressure(in) Weather
========================================================================
75 89% NE at 7 29.85 Overcast
Forecast for Washington, MD
1030 PM EDT Wed Aug 28 2013
.Rest of tonight...Cloudy. Scattered showers late this evening...
then isolated showers. Patchy fog. Lows around 70. South winds
around 5 mph...becoming east. Chance of rain 50 percent.
.Thursday...Mostly cloudy in the morning...then becoming mostly
sunny. Patchy fog in the morning. Scattered sprinkles. Highs in the
lower 80s. Northeast winds 5 to 10 mph.
.Thursday night...Partly cloudy. Scattered sprinkles in the evening.
Lows in the mid 60s. East winds around 5 mph...becoming north after
midnight.
.Friday...Mostly sunny. Highs in the lower 80s. North winds around
5 mph...becoming southeast in the afternoon.
.Friday night...Partly cloudy in the evening...then becoming mostly
cloudy. Lows in the upper 60s. South winds around 5 mph.
.Saturday...Partly sunny. Highs in the mid 80s.
.Saturday night...Mostly cloudy. Lows in the upper 60s.
Press Return to continue, M to return to menu, X to exit: x
Connection closed by foreign host.
[email protected]:~/ruby$
[email protected]:~/ruby$
그냥 명확히하기 위해 여기에 머드에 연결하지 않았습니다.이 것은 테스트 및 일러스트레이션을위한 기상 서비스입니다. 날씨를 확인할 수있게되면 재미와 게임으로 이동합니다 :) – Thufir
나는 그것이 어떻게 관련이 있는지 알 수 없습니다. 날씨가 텔넷 서버입니까? – 7stud
예, 날씨 서비스는 텔넷을 통해, vt100까지 알고 있습니다. 대부분의 CLI (Linux, Windows, Mac)의'telnet rainmaker.wunderground.com 3000'은 정상적으로 작동합니다. (머드의 경우도 마찬가지입니다.) – Thufir