node.js http和SMPP客户端一起工作

时间:2018-06-24 20:44:49

标签: node.js smpp

您好,我正在创建一个用于通过smpp服务器发送SMS的简单Web API,我正在使用node-smpp(https://github.com/farhadi/node-smpp)连接到SMPP服务器。

问题是当smpp绑定到smpp服务器时,我无法访问在端口3000上监听的应用程序。

var smpp = require('smpp');
var http = require('http');

//create a server object:
http.createServer(function (req, res) {
  res.write('Hello World!');
  res.end();
}).listen(3000, function(){
 console.log("server start at port 3000");
});

var session = new smpp.Session({host: 'localhost', port: 2775});
// We will track connection state for re-connecting
var didConnect = false; 
session.on('connect', function(){
  didConnect = true;

  session.bind_transceiver({
      system_id: 'smppclient1',
      password: 'password'
  }, function(pdu) {
    console.log('pdu status', lookupPDUStatusKey(pdu.command_status));
    if (pdu.command_status == 0) {
        console.log('Successfully bound\n')
    }
  });
})

0 个答案:

没有答案