broadlink-java-api icon indicating copy to clipboard operation
broadlink-java-api copied to clipboard

Multiple Network Interfaces

Open ahorseman opened this issue 5 years ago • 2 comments

Hello,

first of all thank you for this great piece of work!

I have a small question regarding systems with multiple interfaces. I run my broadlink devices on a separate network, such that they have no access to the internet. This means I have two ethernet devices in my machine - one to the outside world and one for the internal network.

Is there a way to tell the discoverDevices method (and essentially the whole library) to use only one of the to network interfaces? I haven't found yet a way to do so, but might have just overseen it.

Thanks a lot for any enlightenment.

ahorseman avatar Jun 28 '20 16:06 ahorseman

Currently, BLDevice does not provide a way to bind the DatagramSocket to a specific network interface, and the socket instance is not exposed. It is possible to do that with an API change providing a way to bind a SocketAddress to the socket. Maybe I will make a contribution to make this working.

a1aw avatar Aug 27 '20 07:08 a1aw

https://docs.oracle.com/javase/7/docs/api/java/net/DatagramSocket.html#bind(java.net.SocketAddress)

a1aw avatar Aug 27 '20 07:08 a1aw