mob41 / broadlink-java-api

A clean Broadlink API for Java
MIT License
22 stars 25 forks source link

Multiple Network Interfaces #29

Open ahorseman opened 4 years ago

ahorseman commented 4 years ago

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.

mob41 commented 3 years ago

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.

mob41 commented 3 years ago

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