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

Send data on differents network #7

Open
ptorrent opened this issue Jun 29, 2023 · 2 comments
Open

Send data on differents network #7

ptorrent opened this issue Jun 29, 2023 · 2 comments

Comments

@ptorrent
Copy link

ptorrent commented Jun 29, 2023

Hello there,

Thanks for your tool !

I would like to be able to use it in this scenario:

By example, my device has 2 networks adaptaters:

eth0 : 192.168.1.2
ppp0 : LTE connection

Internet come from LTE. (ip route add default via ppp)

The problem I've is that I'm not able to find the device because default route is set on ppp. To be able to make it work, i've to do that:

ip route add 224.0.0.236 dev eth0

Is there a way to send multicast message on the correct interface ? Actually I'm able to listen multicast message on my device but not to send message without this route

@ptorrent
Copy link
Author

ptorrent commented Jun 29, 2023

I was able to make it work with:

	socket.setMulticastInterface('192.168.1.2'); //LOCAL INTERFACE IP
	socket.send(buffer, 0, buffer.length, port,multicastAddress, function(){
						
	});

Maybe a good feature to add :)

@willemmulder
Copy link
Owner

willemmulder commented Jul 3, 2023

Hey @ptorrent that's an interesting feature, and certainly useful!

A user would need to announce two distinct services though, because otherwise the one service would have two different local addresses on two separate networks.

I think what we should is to check the 'host' property of the service that you're announcing, and try to find a local interface that matches that host address, and then send it through that interface. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants