【问题标题】:node.js Telnet Client testing using Hercules Terminal使用 Hercules 终端的 node.js Telnet 客户端测试
【发布时间】:2019-08-12 17:04:19
【问题描述】:

我正在使用 npm telnet 客户端

我想首先使用终端使用Hercules.exe 对其进行测试。但是,我总是得到“连接超时”。

我已将带有 TCP 服务器的 Hercules 终端设置为端口 23,并且它在 IP 为 192.169.1.79 的本地计算机上运行。但是,当我尝试 Telnet 到 Hercules 终端时,我得到的只是 "socket time out" 。任何线索将不胜感激。

var Telnet = require('telnet-client')
var connection = new Telnet()

var params = {
  host: '192.168.1.79',
  port: 23,
  shellPrompt: '/ # ',
  timeout: 1500,
  // removeEcho: 4
}

connection.on('ready', function(prompt) {
  connection.exec(cmd, function(err, response) {
    console.log(response)
  })
})

connection.on('timeout', function() {
  console.log('socket timeout!')
  connection.end()
})

connection.on('close', function() {
  console.log('connection closed')
})

connection.connect(params)

【问题讨论】:

    标签: node.js tcp client telnet


    【解决方案1】:

    想通了。 1. 在 Hecules TCP 服务器中。您需要在 Timeout 时间范围内发回 shell 提示 '/#'

    1. 您还可以设置 cmd = 'testing' 或您想要发送的任何内容,您可以在 Hercules Received Data 窗口中看到它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-08
      • 1970-01-01
      • 2012-05-30
      • 1970-01-01
      • 2011-03-31
      • 2013-02-15
      • 1970-01-01
      • 2018-06-01
      相关资源
      最近更新 更多