protected String getMediaServerIP(CpMediaServer _mediaServer) { if (_mediaServer == null) { return(String.Empty); } this.writeLog(LogType.Info, "Auflösen der Raumfeld-MedienServer IP"); Uri url = new Uri(mediaServer.Location); try { IPAddress address = IPAddress.Parse(url.Host); return(address.ToString()); } catch (Exception e) { this.writeLog(LogType.Warning, String.Format("IP-Adresse konnte nicht aufgelöst werden. Host: {0} Suche über DNS", url.Host), e); } try { IPHostEntry hostEntry = Dns.GetHostEntry(url.Host); return(hostEntry.AddressList[0].ToString()); } catch (Exception e) { this.writeLog(LogType.Error, String.Format("IP-Adresse konnte nicht per DNS aufgelöst werden. Host: {0}", url.Host), e); // this is a fatal error! App hast to crash! throw new Exception(Global.getCrashInfo()); } }
protected String getMediaServerRequestUri() { String hostRequestUri; if (String.IsNullOrEmpty(mediaServerIpAddress)) { this.writeLog(LogType.Error, "Keine gültige Host IP für erstellen der Request URL!"); // this is a fatal error! App hast to be crashed! throw new Exception(Global.getCrashInfo()); } hostRequestUri = String.Format("http://{0}:{1}/index/", mediaServerIpAddress, raumfeldMediaServerRequestPort); return(hostRequestUri); }