const net = require('net');
let socket = new net.Socket()
net.createServer((socket) => {
socket.on('data', (data) => {
console.log('data: ', data.toString('utf8'))
})
}).listen(3000);
socket.connect({
host : 'localhost', port : 3000
}, () => {
socket.write(Buffer.from('msg1'.repeat(100000), 'utf8')); // send first massege
socket.write(Buffer.from('msg2'.repeat(100000), 'utf8')); // send second massege
})