1
This commit is contained in:
parent
ec7c4797e9
commit
cb70b1f901
16
server/bin/udpclient.js
Normal file
16
server/bin/udpclient.js
Normal file
@ -0,0 +1,16 @@
|
||||
const dgram = require('dgram');
|
||||
const client = dgram.createSocket('udp4');
|
||||
|
||||
client.on('close', () => {
|
||||
console.log('close');
|
||||
});
|
||||
|
||||
client.on('error', () => {
|
||||
console.log('error');
|
||||
});
|
||||
|
||||
client.on('message', (msg, rinfo) => {
|
||||
console.log(`接收到来自:${rinfo.address}:${rinfo.port} 的消息: ${msg}`);
|
||||
});
|
||||
|
||||
client.send('hello', 17601, '108.137.177.19');
|
Loading…
x
Reference in New Issue
Block a user