diff --git a/nodes/core/io/31-tcpin.html b/nodes/core/io/31-tcpin.html index 44920b9c5..ac988ba2d 100644 --- a/nodes/core/io/31-tcpin.html +++ b/nodes/core/io/31-tcpin.html @@ -56,7 +56,7 @@ </script> <script type="text/x-red" data-help-name="tcp in"> - <p>Provides a choice of tcp inputs. Can either connect to a remote tcp port, + <p>Provides a choice of TCP inputs. Can either connect to a remote TCP port, or accept incoming connections.</p> </script> @@ -147,12 +147,14 @@ </script> <script type="text/x-red" data-help-name="tcp out"> - <p>Provides a choice of tcp outputs. Can either connect to a remote tcp port, + <p>Provides a choice of TCP outputs. Can either connect to a remote TCP port, accept incoming connections, or reply to messages received from a TCP In node.</p> - <p>Only <b>msg.payload</b> is sent.</p> - <p>If <b>msg.payload</b> is a string containing a Base64 encoding of binary + <p>Only <code>msg.payload</code> is sent.</p> + <p>If <code>msg.payload</code> is a string containing a Base64 encoding of binary data, the Base64 decoding option will cause it to be converted back to binary before being sent.</p> + <p>If <code>msg._session</code> is not present the payload is + sent to <b>all</b> connected clients.</p> </script> <script type="text/javascript"> @@ -247,12 +249,12 @@ </script> <script type="text/x-red" data-help-name="tcp request"> - <p>A simple TCP request node - sends the <b>msg.payload</b> to a server tcp port and expects a response.</p> - <p>Connects, sends the "request", reads the "response". It can either count a number of + <p>A simple TCP request node - sends the <code>msg.payload</code> to a server tcp port and expects a response.</p> + <p>Connects, sends the "request", and reads the "response". It can either count a number of returned characters into a fixed buffer, match a specified character before returning, wait a fixed timeout from first reply and then return, or just sit and wait for data.</p> - <p>The response will be output in <b>msg.payload</b> as a buffer, so you may want to .toString() it.</p> - <p>If you leave tcp host or port blank they must be set by using the <b>msg.host</b> and <b>msg.port</b> properties.</p> + <p>The response will be output in <code>msg.payload</code> as a buffer, so you may want to .toString() it.</p> + <p>If you leave tcp host or port blank they must be set by using the <code>msg.host</code> and <code>msg.port</code> properties.</p> </script> <script type="text/javascript"> diff --git a/nodes/core/io/31-tcpin.js b/nodes/core/io/31-tcpin.js index c9e9008b7..96ef580af 100644 --- a/nodes/core/io/31-tcpin.js +++ b/nodes/core/io/31-tcpin.js @@ -303,6 +303,17 @@ module.exports = function(RED) { } } } + else { + for (var i in connectionPool) { + if (Buffer.isBuffer(msg.payload)) { + connectionPool[i].write(msg.payload); + } else if (typeof msg.payload === "string" && node.base64) { + connectionPool[i].write(new Buffer(msg.payload,'base64')); + } else { + connectionPool[i].write(new Buffer(""+msg.payload)); + } + } + } }); } else { var connectedSockets = [];