diff --git a/index.js b/index.js index 1add1fe..642c9e9 100644 --- a/index.js +++ b/index.js @@ -1,19 +1,30 @@ var net = require('net'); +/** + * Log the request and forward it. + * @param {String} bytes + */ async function logAndSend(bytes) { - + console.log(bytes) } var server = net.createServer((socket) => { socket.on('end', (c) => { console.log("Client disconnected"); }); + socket.on("data", (c) => { + logAndSend(c.toString()); + }); }) -server.on('connection', () => { - console.log("Client connected!"); +server.on('connection', (c) => { + console.log("Client connected!" + c.read(10)); }); +server.on("listening", (c) => { + console.log("LISTENING"); +}) + server.listen(8124, () => { console.log("Server bound."); }) \ No newline at end of file