Files
ldb/kvs-client/js-kvstore.js
2024-05-25 14:23:43 +00:00

27 lines
456 B
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const net = require('net');
const client = net.createConnection({ port: 2000, host: '192.168.243.131' }, () => {
console.log('connect kvstore');
client.write('GET Teacher');
});
client.on('data', (data) => {
console.log(`recv${data.toString()}`);
client.end();
});
client.on('error', (err) => {
console.error('connect failed', err);
});
client.on('close', () => {
console.log('close connection');
});