Replace port with TCP In


How do replace the port in below code to the output from a TCP in node? I want the piping part to work in below code...

import { connect } from 'net'

// substitute with the IP address of your module
const port = connect({ host: '', port: 2323 })

// constructing a reader that will emit each packet separately
const reader = port
.pipe(new MavLinkPacketSplitter())
.pipe(new MavLinkPacketParser())

reader.on('data', packet => {

This is what I have now:

[{"id":"54935c6833928015","type":"function","z":"a473154c2f0f0272","name":"function 3","func":"const mavlink = global.get('mavlink')\n\nmsg.packet = new mavlink.MavLinkPacketSplitter(msg.payload);\nmsg.packet2 = new mavlink.MavLinkPacketParser(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":680,"wires":[[]]},{"id":"f7146e0c7d21bb61","type":"tcp in","z":"a473154c2f0f0272","name":"","server":"client","host":"","port":"8888","datamode":"stream","datatype":"buffer","newline":"","topic":"","trim":false,"base64":false,"tls":"","x":200,"y":280,"wires":[["54935c6833928015"]]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.