Send broadcast messages to all interfaces#38
Conversation
Look up all available interfaces and build an array of destinations for each for broadcast.
9c89653 to
78515a3
Compare
|
Awesome. One thought I have is if It is possible that there is not an interface with the specified address though ( |
| //TODO: get the default broadcast address from os.networkInterfaces() (not currently returned) | ||
| self.destination = [self.broadcast || "255.255.255.255"]; | ||
|
|
||
| if (self.broadcast) { |
There was a problem hiding this comment.
@wankdanker this handles if the user DOES manually define broadcast as an option, to use what they supplied. Also expands the API to support passing an array instead of a single value.
The new code below only activates if the user did not manually declare broadcast.
|
Oh, to follow on that feedback i noticed you said address now and not broadcast. I can see what you mean now. Not sure best way to implement that though. I assume would have to compare address to cidr/netmask to compare? Are you able to implement those changes? (you do have push to my branch for this PR) |
|
Hi!, are you merging this fix? because I'm having the same issue, my node connects to the other nodes an receives data but those nodes doesn't know about mine and I can't send data. I change the code with this PR and it worked. |
Look up all available interfaces and build an array of destinations for each for broadcast.
Resolves a TODO you had here.
Used a library to implement the logic of turning an address and netmask into a broadcast address.
Have tested this locally where I have 2 ifaces available (wireless and wired), another machine only had 1 (wireless)
Previously had issues where my outbound packets only went out wired, so the wireless client could not receive mine, however I could receive the wireless packets as I was also on wireless.
This resolves the issue by sending my outbound over both wired and wireless.
Resolves #26