Skip to content

[BUG] DeviceGroup.StartMusicMode() won't work for multiple devices #52

Description

@TipicoDev

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:

  1. Find or create multiple new Device() (at least 2)
  2. Group them with new DeviceGroup(IEnumerable)
  3. Call DeviceGroup.Connect() and then call DeviceGroup.StartMusicMode("x.x.x.x", 6969);
  4. 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);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions