schaazzz schaazzz - 1 year ago 87
Node.js Question

TCP/IP Communication, Executing System Commands and Local File Access using Metoer

So, I have this intranet application which parses a bunch of excel files, a read-only MSAccess DB, reads some data from custom hardware connected to serial ports and the network and controls a Vector CANoe simulation using Windows COM. The entire app is written in Python with CherryPy being used for serving web content.

Now new features (e.g. support for users) need to be added to the webapp, I want to port as much of this app as I can to Meteor (using v1.3), mostly because how easy it is to get a prototype up and running.

I can leave the non-web related application logic in the Python app and have Meteor talk to it using IPC implemented over TCP/IP; but at the very least, I need Meteor to be able to execute system commands and connect to TCP/IP sockets.

I've read that the NodeJS net API can be used for the TCP/IP communication part but have yet to figure out how exactly to do it, any help would be much appreciated.

Answer Source

Meteor already includes 'net', we can just use it as follows:

if (Meteor.isServer) {
    var net = Npm.require('net');
    var server = net.createServer(function (client) {
        console.log('A client connected!');

    server.listen(17231, function() {
        console.log('Server bound to 17231!');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download