-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
dgramIssues and PRs related to the dgram subsystem / UDP.Issues and PRs related to the dgram subsystem / UDP.invalidIssues and PRs that are invalid.Issues and PRs that are invalid.
Description
- Version: v10.13.0
- Platform: Linux 4.4.0-36-generic Proposal: Move isaacs/readable-stream to iojs and make it the authoratative source #55-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: dgram
When using dgram for only sending UDP messages, upon the first send there is an automatic bind to 0.0.0.0
Trying to explicitly bind to 127.0.0.1 will cause send to fail with the error message:
Error: send EINVAL 111.111.111.111:11111
at SendWrap.afterSend [as oncomplete] (dgram.js:467:11)
Reproduction:
let PORT = 11111;
let HOST = '111.111.111.111';
let dgram = require('dgram');
let message = Buffer.from('Testing!');
let client = dgram.createSocket('udp4');
client.bind(0, '127.0.0.1'); /////////////////// remove this line for auto bind or change to 0.0.0.0 to be able to send
client.send(message, 0, message.length, PORT, HOST, function(err, bytes) {
if (err) throw err;
console.log('UDP message sent to ' + HOST +':'+ PORT);
client.close();
});
Metadata
Metadata
Assignees
Labels
dgramIssues and PRs related to the dgram subsystem / UDP.Issues and PRs related to the dgram subsystem / UDP.invalidIssues and PRs that are invalid.Issues and PRs that are invalid.