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