mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
5931e13b9c
commit
0968f96982
@ -52,6 +52,7 @@ module.exports = function(RED) {
|
||||
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
});
|
||||
client.setKeepAlive(true,120000);
|
||||
connectionPool[id] = client;
|
||||
|
||||
client.on('data', function (data) {
|
||||
@ -123,7 +124,8 @@ module.exports = function(RED) {
|
||||
clearTimeout(reconnectTimeout);
|
||||
if (!node.connected) { done(); }
|
||||
});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
var server = net.createServer(function (socket) {
|
||||
socket.setKeepAlive(true,120000);
|
||||
if (socketTimeout !== null) { socket.setTimeout(socketTimeout); }
|
||||
@ -184,6 +186,7 @@ module.exports = function(RED) {
|
||||
node.log(err);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('error', function(err) {
|
||||
if (err) {
|
||||
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err.toString()}));
|
||||
@ -237,6 +240,7 @@ module.exports = function(RED) {
|
||||
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
});
|
||||
client.setKeepAlive(true,120000);
|
||||
client.on('error', function (err) {
|
||||
node.log(RED._("tcpin.errors.error",{error:err.toString()}));
|
||||
});
|
||||
@ -288,7 +292,8 @@ module.exports = function(RED) {
|
||||
if (!node.connected) { done(); }
|
||||
});
|
||||
|
||||
} else if (node.beserver == "reply") {
|
||||
}
|
||||
else if (node.beserver == "reply") {
|
||||
node.on("input",function(msg) {
|
||||
if (msg._session && msg._session.type == "tcp") {
|
||||
var client = connectionPool[msg._session.id];
|
||||
@ -314,7 +319,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
var connectedSockets = [];
|
||||
node.status({text:RED._("tcpin.status.connections",{count:0})});
|
||||
var server = net.createServer(function (socket) {
|
||||
|
Loading…
Reference in New Issue
Block a user