2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2014-07-02 15:24:17 +02:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
var dgram = require('dgram');
|
|
|
|
var client, timer, buf, len, offset;
|
|
|
|
|
|
|
|
|
|
|
|
client = dgram.createSocket('udp4');
|
|
|
|
|
2016-01-25 15:00:06 -08:00
|
|
|
buf = Buffer.allocUnsafe(256);
|
2014-07-02 15:24:17 +02:00
|
|
|
offset = 20;
|
|
|
|
|
|
|
|
len = buf.length - offset;
|
|
|
|
|
|
|
|
|
2015-05-19 13:00:06 +02:00
|
|
|
client.send(buf, offset, len, common.PORT, '127.0.0.1', function(err, bytes) {
|
|
|
|
assert.notEqual(bytes, buf.length);
|
|
|
|
assert.equal(bytes, buf.length - offset);
|
|
|
|
clearTimeout(timer);
|
|
|
|
client.close();
|
2014-07-02 15:24:17 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
timer = setTimeout(function() {
|
|
|
|
throw new Error('Timeout');
|
|
|
|
}, 200);
|