• 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.alloc(256, 'x');
10
11const onMessage = common.mustSucceed((bytes) => {
12  assert.strictEqual(bytes, buf.length);
13  client.close();
14});
15
16client.bind(0, () => client.send(buf, client.address().port, onMessage));
17