request.js/tests/tcp-listener.js

12 lines
278 B
JavaScript
Raw Normal View History

2018-07-07 01:38:47 +00:00
'use strict';
var net = require('net');
2021-01-14 23:07:48 +00:00
var server = net.createServer(function (socket) {
socket.on('data', function (chunk) {
2019-10-29 20:31:30 +00:00
console.info(chunk.toString('utf8'));
});
});
2021-01-14 23:07:48 +00:00
server.listen(3007, function () {
2019-10-29 20:31:30 +00:00
console.info('Listening on', this.address());
2018-07-07 01:38:47 +00:00
});