Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[windows]dgram socket not receiving on network without internet connection #17980

Closed
farfromrefug opened this issue Jan 4, 2018 · 7 comments
Closed
Labels
dgram Issues and PRs related to the dgram subsystem / UDP. windows Issues and PRs related to the Windows platform.

Comments

@farfromrefug
Copy link

I have a server running on a raspberry PI.
that server regularly broadcast over all its interfaces.
that server also publish an adhoc network using hostapd

Now i have clients apps on Windows/Macos that should receive the broadcast using dgram sockets.
Everything works perfectly on macos.
On windows in works when both are the same network with internet connection.

Now when the windows client (windows 10, nodejs 8.6.0) is connected to the Pi Adhoc network the dgram socket does not see the messages. It binds correctly but that s it.
I know this issue is within nodejs because wireshark correctly sees the UDP packets and everything is good.

The client code is as simple as this:

const dgram = require('dgram');
const socket = dgram.createSocket({
    type:'udp4',
    reuseAddr: true
});

socket.on("message", (msg, rinfo) => {
   console.log('message', msg, rinfo);
}).on("listening", () => {
    // console.log('udp listening');
    // this.sockets[interName] = socket;
    console.log('udp listening', socket.address());
}).on("error", (err) => {
    console.log('udp error', err);
}).on("close", () => {
    console.log('udp close', err);

});
console.log('bind', 2900, '0.0.0.0');
socket.bind(2900, '0.0.0.0');

I am not sure it s related to internet but that's the only thing i see.
I tried with a custom lookup method too but it does not seem to change anything.

Any help would be appreciated.

Thanks

@bnoordhuis bnoordhuis added dgram Issues and PRs related to the dgram subsystem / UDP. windows Issues and PRs related to the Windows platform. labels Jan 4, 2018
@bnoordhuis
Copy link
Member

I know this issue is within nodejs because wireshark correctly sees the UDP packets and everything is good.

Can you expand? Post wireshark or tcpdump output if you have it.

@farfromrefug
Copy link
Author

@bnoordhuis sure will do this. Can't do it before monday though

@bzoz
Copy link
Contributor

bzoz commented Jan 5, 2018

Of the top of my head, two issues could be related: #14900 and #17641 (which is fixed on master)

@farfromrefug
Copy link
Author

farfromrefug commented Jan 5, 2018

@bzoz about the first one. I don't if it's relevant but i do get the "listening" event, but no message after that. Also binding to '0.0.0.0' does work when the network as internet connection

@farfromrefug
Copy link
Author

Here is the export wireshark report.
Is that what you want? or do you prefer another format?
udp-error.zip

@bnoordhuis
Copy link
Member

I see PONG datagrams being broadcasted from 192.138.143.1:2900 to 192.138.143.255:2900 that advertise something about port 7265. If this...

I know this issue is within nodejs because wireshark correctly sees the UDP packets and everything is good.

...means wireshark receives packets while node.js does not (on the same machine), then you probably have a firewall or routing rule that drops the packets, or something to that effect.

Tools like wireshark and tcpdump are not affected by that because they run very early in the filter chain and they put the interface into promiscuous mode so they can capture all network traffic, not just deliverable traffic.

Since I don't see anything that indicates a node.js bug I'm going to close this out but if you have evidence to the contrary (say, a python script that works where node.js does not), then please post it.

If you have follow-up questions, then by all means post them to the help repo. Cheers.

@farfromrefug
Copy link
Author

@bnoordhuis I tried without the firewall and it does the same.
But actually trying with python is a good idea. Will try that

And sorry didn't know about the help repo.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dgram Issues and PRs related to the dgram subsystem / UDP. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

3 participants