Skip to content

Commit 62a4319

Browse files
author
alicevm
committed
first step
1 parent 7862b4d commit 62a4319

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

2023-03-28/mytcpserver/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const net = require("net");
2+
const server = net.createServer();
3+
4+
server.on("connection", handleConnection);
5+
6+
server.listen(12345, "0.0.0.0", () => {
7+
console.log(`server listening ${JSON.stringify(server.address())}`);
8+
})
9+
10+
function handleConnection(socket) {
11+
console.log(`Nuevo cliente desde ${socket.remoteAddress}:${socket.remotePort}`);
12+
}

0 commit comments

Comments
 (0)