farhadi / node-smpp

SMPP client and server implementation in node.js
MIT License
417 stars 177 forks source link

Pdu command length error #230

Open ijoe7 opened 1 year ago

ijoe7 commented 1 year ago

Hello I have this issue while connecting to a server:

App running on Port: 5000
2023-05-07T19:21:15.811Z - cli - 878563 - server.connected - connected to server - {"secure":false} - [172.31.34.175]
2023-05-07T19:21:15.812Z - cli - 878563 - pdu.command.out - bind_transceiver - {"command":"bind_transceiver","command_length":0,"command_id":9,"command_status":0,"sequence_number":1,"system_id":"****","password":"****","system_type":"","interface_version":80,"addr_ton":0,"addr_npi":0,"address_range":""} - [172.31.34.175]
2023-05-07T19:21:15.813Z - cli - 878563 - socket.data.out -  - {"bytes":37} - [172.31.34.175]
2023-05-07T19:21:15.815Z - cli - 878563 - socket.data.in -  - {"bytes":309} - [172.31.34.175]
2023-05-07T19:21:15.815Z - cli - 878563 - pdu.command.error - PDU length was too large (1213486160, maximum is 16384). - {} - [172.31.34.175]
SMPP session error: Error: PDU length was too large (1213486160, maximum is 16384).
    at PDU.commandLength (/usr/src/app/node_modules/smpp/lib/pdu.js:50:9)
    at Session._extractPDUs (/usr/src/app/node_modules/smpp/lib/smpp.js:188:32)

I don't know if you know what could be causing this, because I have tried rewriting the code but I keep getting the same issue.

ijoe7 commented 1 year ago

An update on the error:

2023-05-07T20:35:00.767Z - cli - 901491 - server.connected - connected to server - {"secure":false} - [172.31.34.175]
2023-05-07T20:35:00.767Z - cli - 901491 - pdu.command.out - bind_transceiver - {"command":"bind_transceiver","command_length":0,"command_id":9,"command_status":0,"sequence_number":1,"system_id":"****","password":"****","system_type":"","interface_version":80,"addr_ton":0,"addr_npi":0,"address_range":""} - [172.31.34.175]
2023-05-07T20:35:00.768Z - cli - 901491 - socket.data.out -  - {"bytes":37} - [172.31.34.175]
2023-05-07T20:35:00.770Z - cli - 901491 - socket.data.in -  - {"bytes":309} - [172.31.34.175]
2023-05-07T20:35:00.771Z - cli - 901491 - pdu.command.error - PDU length was too large (1213486160, maximum is 16384). - {} - [172.31.34.175]
SMPP session error: Error: PDU length was too large (1213486160, maximum is 16384).
    at PDU.commandLength (/usr/src/app/node_modules/smpp/lib/pdu.js:50:9)
    at Session._extractPDUs (/usr/src/app/node_modules/smpp/lib/smpp.js:188:32)
DB connected...
2023-05-07T20:35:10.770Z - cli - 901491 - pdu.command.out - enquire_link - {"command":"enquire_link","command_length":0,"command_id":21,"command_status":0,"sequence_number":2} - [172.31.34.175]
2023-05-07T20:35:10.770Z - cli - 901491 - socket.data.out -  - {"bytes":16} - [172.31.34.175]
2023-05-07T20:35:20.778Z - cli - 901491 - pdu.command.out - enquire_link - {"command":"enquire_link","command_length":0,"command_id":21,"command_status":0,"sequence_number":3} - [172.31.34.175]
2023-05-07T20:35:20.779Z - cli - 901491 - socket.data.error -  - {"error":"Cannot write command enquire_link to socket","errorType":"socket_write_error"} - [172.31.34.175]
2023-05-07T20:35:20.780Z - cli - 901491 - socket.error - write EPIPE - {"errno":-32,"code":"EPIPE","syscall":"write"} - [172.31.34.175]
SMPP session error: Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}
2023-05-07T20:35:20.783Z - cli - 901491 - server.disconnected - disconnected from server -  - [172.31.34.175]
SMPP session closed
franckck commented 8 months ago

Hello @ijoe7

To solve this error : 2023-05-07T19:21:15.815Z - cli - 878563 - pdu.command.error - PDU length was too large (1213486160, maximum is 16384). - {} - [172.31.34.175]

Update PDU maximum length global variable in your main application file like that : const smpp = require('smpp'); smpp.PDU.maxLength = 1213486165