From c61580d19b8d68b0602b1d7f401cd81bf46bb231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CC=B8=CC=BD=CC=BE=CC=92=CD=89=CC=AF=CC=9F=CD=87=CC=97?= =?UTF-8?q?=CC=A8=CC=A1=CD=88=CD=99=CD=99=CC=9D=CD=8DA=CC=B6=CC=86=CC=8A?= =?UTF-8?q?=CD=81=CC=81=CC=8F=CC=88=CD=8C=CC=BE=CC=8D=CD=98=CC=80=CD=84?= =?UTF-8?q?=CC=82=CC=8B=CC=94=CC=87=CC=9A=CD=90=CC=94=CC=80=CC=BA=CC=9D?= =?UTF-8?q?=CC=9E=CD=9C=20=CC=B4=CD=84=CD=88=CC=9C=CC=A2=CC=A6=CD=94=CC=A6?= =?UTF-8?q?=CD=85=CC=A6=CC=96=CC=97=CD=9A=CC=A6Z=CC=B6=CC=BF=CC=AB=CC=A5?= =?UTF-8?q?=CC=AD=CD=8E=CC=9D=CC=BB=CD=85=CC=AE=CC=98=CC=AF=CC=B3=20=CC=B4?= =?UTF-8?q?=CD=A0=CC=85=CD=8A=CD=92=CD=82=CD=A0=CD=8C=CC=86=CD=82=CD=88H?= =?UTF-8?q?=CC=B4=CC=9B=CC=93=CC=BE=CC=8C=CC=BA=CD=95=CC=B3=CC=B1=CD=85?= =?UTF-8?q?=CC=A8=CD=99=CC=A9=CC=BB=CC=A9=CD=85=CC=96=CC=B2=CD=99=CC=98=20?= =?UTF-8?q?=CC=B7=CC=84=CC=8A=CD=84=CD=A0=CD=80=CC=83=CC=80=CC=82=CC=90?= =?UTF-8?q?=CD=8A=CC=90=CC=84=CD=9D=CC=84=CC=81=CC=85=CC=9A=CD=82=CD=84?= =?UTF-8?q?=CC=8B=CD=8E=CC=A5=CC=96=CC=AC=CC=BC=CD=8E=CC=B9=CC=BC=CC=AD?= =?UTF-8?q?=CC=BA=CC=AA=CC=AF=CC=B1=CC=A5=CC=96A=CC=B8=CD=80=CD=9B=CD=80?= =?UTF-8?q?=CC=92=CC=8B=CD=9B=CD=84=CC=8A=CC=9D=CC=96=CD=87=CC=A2=CC=A4?= =?UTF-8?q?=CC=B9=CC=A5=CD=99=CD=8E=CC=B3=CC=BC=CC=AC=CC=B2=CC=B0=CC=BC?= =?UTF-8?q?=CC=A9=20=CC=B4=CD=84=CC=8E=CD=9D=CC=BF=CC=87=CD=81=CC=A3=CC=B9?= =?UTF-8?q?=CC=A9=CC=A5=CC=BA=CC=99=CC=AA=CD=8E=CD=95=CC=AD=CC=9F=CC=B2?= =?UTF-8?q?=CD=87=CC=98=CC=BAR=CC=B7=CC=92=CC=8C=CC=B2=CD=85=CC=BA=CC=B3?= =?UTF-8?q?=CC=A2=CC=96=CC=A2=CC=B9=CC=A7=CC=A1=CD=88=CC=99=CC=B0=CC=99?= =?UTF-8?q?=CC=A5=CC=BC=CC=97=CD=8D=CC=A2?= <96749372+a0zhar@users.noreply.github.com> Date: Sun, 5 Mar 2023 17:50:04 +0100 Subject: [PATCH] Create server(run_on_pc).js --- server(run_on_pc).js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 server(run_on_pc).js diff --git a/server(run_on_pc).js b/server(run_on_pc).js new file mode 100644 index 0000000..7dcb8bf --- /dev/null +++ b/server(run_on_pc).js @@ -0,0 +1,23 @@ +var sheesh = require('ws'); +var fs = require('fs'); +var server = new sheesh.Server({ port: 5000 }); + +server.on('connection', (socket) => { + console.log('Client connected'); + + socket.on('message', (message) => { + console.log("writing"); + const bytes = message.toString().split(',').map(Number); + const text = String.fromCharCode.apply(null, bytes); + // this what i mean by u having to manually change file name + fs.appendFile("name.bin", text, (err) => { + if (err) throw err; + console.log('Data appended to file'); + }); + }); + + socket.on('close', () => { + console.log('Client disconnected'); + }); + +});