/// <summary> /// Start the hat client /// </summary> public async Task StartHatClientAsync() { TimeStamp = DateTimeOffset.UtcNow; await StopHatClientAsync(); try { LocalIpAddress = NetworkUtilities.GetLocalIPAddress(); } catch (Exception e) { Log?.Invoke(this, new LogEventArgs(this, "StartHatClientAsync", $"Unable to get local IP address.{e}", LogLevel.ERROR)); } ReadStatusTaskCancelTokenSource = new CancellationTokenSource(); ReadStatusPortTask = RunReadStatusPortAsync(ReadStatusTaskCancelTokenSource.Token); Log?.Invoke(this, new LogEventArgs(HostName, this, "StartHatClient", $"Started HatServer for {HostName}.", LogLevel.INFO)); }
/// <summary> /// Update local IP address any time network address changes /// </summary> void NetworkChange_NetworkAddressChanged(object sender, EventArgs e) { LocalIpAddress = NetworkUtilities.GetLocalIPAddress(); }