Gestisci timeout sui client TCP

master
Guido Longoni 2026-05-06 12:20:44 +02:00
parent 597cc781c4
commit c98b5f396f
1 changed files with 8 additions and 0 deletions

View File

@ -135,6 +135,10 @@ module.exports = function(RED) {
buffer = null;
}
});
client.on('timeout', function() {
node.log(RED._("tcpin.errors.timeout",{port:node.port}));
client.end();
});
client.on('close', function() {
delete connectionPool[id];
node.connected = false;
@ -310,6 +314,10 @@ module.exports = function(RED) {
node.status({});
node.connected = false;
});
client.on('timeout', function() {
node.log(RED._("tcpin.errors.timeout",{port:node.port}));
client.end();
});
client.on('close', function() {
node.status({fill:"red",shape:"ring",text:"common.status.disconnected"});
node.connected = false;