lab12: init

This commit is contained in:
2026-04-07 15:25:17 -07:00
parent 091481091b
commit 7661769b52
9 changed files with 209 additions and 0 deletions

23
lab12/tcpserver.js Normal file
View File

@@ -0,0 +1,23 @@
var net = require('net');
var eol = require('os').EOL;
var srvr = net.createServer();
srvr.on('connection', function(client) {
client.write('Hello there!' + eol);
client.end();
});
srvr.listen(9000);
// node tcpserver.js
/*
$ telnet 127.0.0.1 9000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello there!
Connection closed by foreign host.
*/