Code Monkey home page Code Monkey logo

Comments (2)

Alexey1100 avatar Alexey1100 commented on August 13, 2024

You didn't define neither prompt nor match pattern for your cmd.
Take a look at the example in README.

from net-telnet.

pommechocolat avatar pommechocolat commented on August 13, 2024

I have a similar issue, but neither "Prompt" or "Match" work. This is because the Telnet server don't send any prompt. And the waitfor in the cmd function send only a Prompt in 0.2.0 version. I made a test in rewriting the cmd function that's give me satisfaction. Is my solution correct ? Could a correction be donne in next version ?

    def cmd(options) # :yield: recvdata
      match    = @options["Prompt"]
      time_out = @options["Timeout"]
      fail_eof = @options["FailEOF"]
      typeMatch = "Prompt"

      if options.kind_of?(Hash)
        cmd   = options["Cmd"] if options.has_key?("String")
        if options.has_key?("String")
          match    = options["String"]
          typeMatch="String"
        end
        if options.has_key?("Match")
          match    = options["Match"]
          typeMatch="Match"
        end
        time_out = options["Timeout"] if options.has_key?("Timeout")
        fail_eof = options["FailEOF"] if options.has_key?("FailEOF")
      else
        cmd = options
      end

      self.puts(cmd)
      if block_given?
        waitfor({typeMatch => match, "Timeout" => time_out, "FailEOF" => fail_eof}){|c| yield c }
      else
        waitfor({typeMatch => match, "Timeout" => time_out, "FailEOF" => fail_eof})
      end
    end

from net-telnet.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.