-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Describe the bug
When using the method DeviceGroup.StartMusicMode(), the parameters are a single hostname and port. The problem is that starting multiple TcpListener using the same port will throw an exception:
System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
To Reproduce
Steps to reproduce the behavior:
- Find or create multiple new Device() (at least 2)
- Group them with new DeviceGroup(IEnumerable)
- Call DeviceGroup.Connect() and then call DeviceGroup.StartMusicMode("x.x.x.x", 6969);
- See error
Expected behavior
The lib should start the music mode in every device added.
Stacktrace
System.Net.Sockets.SocketException: Normalmente é permitida apenas uma utilização de cada endereço de soquete (protocolo/endereço de rede/porta)
em System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
em System.Net.Sockets.Socket.Bind(EndPoint localEP)
em System.Net.Sockets.TcpListener.Start(Int32 backlog)
em System.Net.Sockets.TcpListener.Start()
em YeelightAPI.Device.d__97.MoveNext()
Environment (please complete the following information):
- OS: Windows 10 x64
- .NET Framework 4.8
Additional context
You can bypass this error by looping through each device and calling Device.StartMusicMode(null, uniquePort);