2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-12-01 17:21:41 +01:00
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const dgram = require('dgram');
|
2013-06-27 00:43:23 +02:00
|
|
|
|
|
|
|
// Send a too big datagram. The destination doesn't matter because it's
|
|
|
|
// not supposed to get sent out anyway.
|
2016-12-01 17:21:41 +01:00
|
|
|
const buf = Buffer.allocUnsafe(256 * 1024);
|
|
|
|
const sock = dgram.createSocket('udp4');
|
2013-06-27 00:43:23 +02:00
|
|
|
sock.send(buf, 0, buf.length, 12345, '127.0.0.1', common.mustCall(cb));
|
|
|
|
function cb(err) {
|
|
|
|
assert(err instanceof Error);
|
2016-12-01 17:21:41 +01:00
|
|
|
assert.strictEqual(err.code, 'EMSGSIZE');
|
|
|
|
assert.strictEqual(err.address, '127.0.0.1');
|
|
|
|
assert.strictEqual(err.port, 12345);
|
|
|
|
assert.strictEqual(err.message, 'send EMSGSIZE 127.0.0.1:12345');
|
2013-06-27 00:43:23 +02:00
|
|
|
sock.close();
|
|
|
|
}
|