Add response to discover command.

This commit is contained in:
Stone_Red
2023-02-06 15:28:53 +01:00
parent fb21a9f492
commit 6f9626fcfd
2 changed files with 6 additions and 1 deletions
@@ -19,8 +19,13 @@ public class HostCommands
public void Discover(string _) public void Discover(string _)
{ {
ApiManager.SendNotificationMessageNewLine("Running local discovery routine...", NotificationMessageType.Info); ApiManager.SendNotificationMessageNewLine("Running local discovery routine...", NotificationMessageType.Info);
int hostsCountBefore = hostsManager.Count;
BroadcastClient.Send(ApiConfiguration.BroadcastPort, ApiConfiguration.PrivatePort.ToString()); BroadcastClient.Send(ApiConfiguration.BroadcastPort, ApiConfiguration.PrivatePort.ToString());
Thread.Sleep(3000); Thread.Sleep(3000);
ApiManager.SendNotificationMessageNewLine($"Found {hostsManager.Count - hostsCountBefore} host(s)", NotificationMessageType.Info);
} }
public void CheckActiveHosts(string _) public void CheckActiveHosts(string _)
@@ -149,7 +149,7 @@ public class ApiManager
return; return;
} }
_ = hostsToSend.RemoveAll(x => x.IPAddress == recivedEventArgs.IPEndPoint.Address.ToString()); _ = hostsToSend.RemoveAll(x => x.IPAddress == remoteIpAddress.ToString());
hostsToSend.Add(localSocket); hostsToSend.Add(localSocket);
bool success = int.TryParse(recivedEventArgs.Message, out int remotePort); bool success = int.TryParse(recivedEventArgs.Message, out int remotePort);