dgram,test: add tests for setBroadcast() by Trott · Pull Request #6750 · nodejs/node · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/api/dgram.md
8 changes: 5 additions & 3 deletions test/internet/test-dgram-broadcast-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ if (common.inFreeBSDJail) {
return;
}

// take the first non-internal interface as the address for binding
// Take the first non-internal interface as the address for binding.
// Ideally, this should check for whether or not an interface is set up for
// BROADCAST and favor internal/private interfaces.
get_bindAddress: for (var name in networkInterfaces) {
var interfaces = networkInterfaces[name];
for (var i = 0; i < interfaces.length; i++) {
Expand Down Expand Up @@ -209,7 +211,7 @@ if (process.argv[2] === 'child') {

receivedMessages.push(buf);

process.send({ message: buf.toString() });
process.send({message: buf.toString()});

if (receivedMessages.length == messages.length) {
process.nextTick(function() {
Expand All @@ -228,7 +230,7 @@ if (process.argv[2] === 'child') {
});

listenSocket.on('listening', function() {
process.send({ listening: true });
process.send({listening: true});
});

listenSocket.bind(common.PORT);
Expand Down
39 changes: 39 additions & 0 deletions test/parallel/test-dgram-setBroadcast.js