We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 79c2417 commit 1c80a3dCopy full SHA for 1c80a3d
05-UDP/index.js
@@ -0,0 +1,9 @@
1
+import dgram from 'dgram'
2
+
3
+const socket = dgram.createSocket('udp4')
4
5
+socket.bind(5500, "127.0.0.1")
6
7
+socket.on("message", (msg, info)=>{
8
+ console.log(`New message: ${msg.toString()} from ${info.address}:${info.port}`);
9
+})
05-UDP/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "05-UDP",
+ "version": "1.0.0",
+ "description": "UDP server from scratch with nodejs",
+ "main": "index.ts",
+ "author": "onecode24",
+ "license": "MIT",
+ "dependencies": {
+ "dgram": "^1.0.1"
10
+ },
11
+ "devDependencies": {}
12
+}
0 commit comments