Skip to content

Commit

Permalink
Fixed annoyning bug with udp port solely binding
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-brutsky committed Jan 23, 2025
1 parent 90e8c3a commit a17f6e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MiHomeLib/Transport/UdpTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public UdpTransport(string gwPassword, string multicastAddress = "224.0.0.50", i
_multicastAddress = multicastAddress;
_serverPort = serverPort;

_udpClient = new UdpClient(new IPEndPoint(IPAddress.Any, _serverPort));
_udpClient = new UdpClient();
_udpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
_udpClient.Client.Bind(new IPEndPoint(IPAddress.Any, _serverPort));
_udpClient.JoinMulticastGroup(IPAddress.Parse(_multicastAddress));
}

Expand Down

0 comments on commit a17f6e5

Please sign in to comment.