0.0.3 • Published 9 years ago
netmon v0.0.3
netmon
![Dependency Status]()
Executes and runs command remotely over socket.
Overview
Module consist of one Server and one Client. A Server can be started on a machine where commands would be executed.
On Another machine a client can connect to server via API and request the server to run the command and provide the output as callback.
The server runs command asynchronously thus serving multiple clients at a time.
Installation
$ npm install --save netmon
Usage
Setting up server is as simple as following code. Port and host are optional and defaults to 7991, localhost.
var nm = require('netmon');
var server = new nm.Server(7991, 'localhost');
server.serve();
$ node server.js
Server started at localhost:7991
[127.0.0.1:64749] -- uname -a
Client can connect to using following code
var nm = require('netmon');
var client = new nm.Client('localhost', 7991);
client.exec('uname', '-a', function(err, out) {
if (err) {
return console.log(err.message);
}
process.stdout.write(out);
});
$ node client.js
Linux elementaryOs 4.4.0-38-generic #57~14.04.1-Ubuntu SMP Tue Sep 6 17:20:43 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux