• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const assert = require('assert');
5const dgram = require('dgram');
6
7const client = dgram.createSocket('udp4');
8
9const buf = Buffer.allocUnsafe(256);
10
11const onMessage = common.mustSucceed((bytes) => {
12  assert.strictEqual(bytes, buf.length);
13  client.close();
14});
15
16client.bind(0, () => client.send(buf,
17                                 client.address().port,
18                                 common.localhostIPv4,
19                                 onMessage));
20