My plan is to write a Query "class" in NodeJS which connects to a server and sends some data.
My Query.js
var net = require('net');
function Query(ip,port,user,pass,sid){
        this.ip = ip;
        this.port = port;
        this.user = user;
        this.pass = pass;
        this.sid = sid;
        this.dataString = "";
        this.socket = net.connect(port,ip,function(){
            this.socket.write("login "+user+" "+pass+"\r\n");
            this.socket.write("use "+sid+"\r\n");
        });
        this.socket.on("data", function (data) {
            this.dataString += data.toString();  
        });
}
Query.prototype.test = function(){
    this.socket.write("logview\r\n");
}
module.exports = Query;
This is the part where I create an object (index.js):
var srvleinQ = new Query(config.Serverlein.adress,config.Serverlein.port,config.Serverlein.user,config.Serverlein.pass,config.Serverlein.sid);
srvleinQ.test();
htmlData = srvleinQ.dataString;
IP,Port and login data are correct!

