Search code examples
node.jsnginxmeteoriot

How can I read a packet with on my nginx server, I am sending the packages with packet sender


I am sending TCP packets with packet sender. I need to process those packets on my Nginx web server.

I am going to store the data on my database and present it on the front-end later on with MeteorJS. Can I do the packet receiving with node.js and how?

I'll be appreciated if you can help me, thanks.


Solution

  • I have handled this situation with node.js using createServer from "net", here is my server main.js

    import { Meteor } from 'meteor/meteor';
    import { createServer } from "net";
    
    Meteor.startup(() => {
    
      const server = createServer(socket => {
        socket.write("RECEIVED!")
        socket.on("data", data => {
          const text = data.toString();
          console.log(text);
        })
      })
    
      server.listen(8080)
    
    });