Having some problems with the code bellow,
its a tcp client relaying data to a tcp server
Would like to add "test" to data before its resent to tcpreciver
as it is now "test" it added but it ends up on the next row in the reciving
side
Reciver log:
OK 07/06/2015 06:05:33 |1;9;13/31/1;20150605;144846;3;|
OK 07/06/2015 06:05:33 |test|
Need it to look like
OK 07/06/2015 06:05:33 |1;9;13/31/1;20150605;144846;3;test|
in the reciver end
var net = require('net');
var clienttcp = new net.Socket();
var tcpreciver = new net.Socket();
tcpreciver.connect(9003, '192.168.81.81', function() {
console.log('tcpreciver Connected');
});
clienttcp.connect(9002, '192.168.81.124', function() {
console.log('clienttcp Connected');
clienttcp.write('POLL\r\n');
});
var pollinterval = setInterval(function () {clienttcp.write('POLL\r\n');},
10000);
clienttcp.on('data', function(data) {
console.log('Received: ' + data);
clienttcp.write('ACK\r\n');
tcpreciver.write(data + 'test');
tcpreciver.write('\r\n');
});
clienttcp.on('close', function() {
console.log('Connection clienttcp closed');
});
tcpreciver.on('close', function() {
console.log('Connection tcpreciver closed');
});
All help appriciated.
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/24d86514-3652-4f5d-be68-a9666a27c04c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.