diff --git a/IOB-UT/baseUtils.cs b/IOB-UT/baseUtils.cs
index a692439e..bc2f0edd 100644
--- a/IOB-UT/baseUtils.cs
+++ b/IOB-UT/baseUtils.cs
@@ -336,6 +336,63 @@ namespace IOB_UT
}
return answ;
}
+ ///
+ /// IP della macchina
+ ///
+ ///
+ public static string GetIP()
+ {
+ NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
+ String sIpAddr = string.Empty;
+ foreach (NetworkInterface adapter in nics)
+ {
+ if (sIpAddr == String.Empty)// only return IP Address from first card
+ {
+ IPInterfaceProperties properties = adapter.GetIPProperties();
+ foreach (var item in properties.UnicastAddresses)
+ {
+ if (item.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
+ {
+ sIpAddr = item.Address.ToString();
+ }
+ }
+ }
+ }
+ return sIpAddr;
+ }
+ ///
+ /// Macaddress della macchina
+ ///
+ ///
+ public static string GetMACAddress()
+ {
+ NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
+ String sMacAddress = string.Empty;
+ foreach (NetworkInterface adapter in nics)
+ {
+ if (sMacAddress == String.Empty)// only return MAC Address from first card
+ {
+ IPInterfaceProperties properties = adapter.GetIPProperties();
+ //sMacAddress = adapter.GetPhysicalAddress().ToString();
+ sMacAddress = string.Join(":", (from z in adapter.GetPhysicalAddress().GetAddressBytes() select z.ToString("X2")).ToArray());
+ }
+ }
+ return sMacAddress;
+ }
+ ///
+ /// Effettua chaimata URL e restituisce risultato
+ ///
+ ///
+ ///
+ public static string callUrl(string URL)
+ {
+ string answ = "";
+ var client = new WebClient();
+ client.Headers.Add("user-agent", CRS("appName"));
+ answ = client.DownloadString(URL);
+ // restituisco valore!
+ return answ;
+ }
}
///
/// Oggetto timing x archiviazione dati perfomances
diff --git a/IOB-WIN/DATA/CONF/MAIN.ini b/IOB-WIN/DATA/CONF/MAIN.ini
index 9cc17ded..95af27ce 100644
--- a/IOB-WIN/DATA/CONF/MAIN.ini
+++ b/IOB-WIN/DATA/CONF/MAIN.ini
@@ -6,8 +6,7 @@ NAME=develop
[SERVER]
MPIP=10.74.82.219
MPURL=/MP/IO
-CMDALIVE=/IOB
-CMDREBO=/sendReboot.aspx?idxIOB=
+CMDREBO=/sendReboot.aspx?IP=
[IOB]
STARTLIST=3001,3002,3003,3004,3005
\ No newline at end of file
diff --git a/IOB-WIN/MainForm.cs b/IOB-WIN/MainForm.cs
index 3ff7a2b3..018b57d0 100644
--- a/IOB-WIN/MainForm.cs
+++ b/IOB-WIN/MainForm.cs
@@ -111,7 +111,37 @@ namespace IOB_WIN
return string.Format("http://seriate.steamware.net:8083/SWS/MAPO/IOB-WIN/{0}/manifest.xml", branchName);
}
}
+ ///
+ /// IP del PC
+ ///
+ protected string currIP
+ {
+ get
+ {
+ string answ = "127.0.0.1";
+ return answ;
+ }
+ }
+ ///
+ /// URL per segnalazione reboot...
+ ///
+ protected string urlReboot
+ {
+ get
+ {
+ string answ = "";
+ try
+ {
+ answ = string.Format(@"http://{0}{1}{2}{3}&mac={4}", MPIP, MPURL, CMDREBO, utils.GetIP(), utils.GetMACAddress());
+ }
+ catch
+ {
+ answ = string.Format(@"{0}{1}{2}{3}", MPIP, MPURL, CMDREBO, utils.GetIP());
+ }
+ return answ;
+ }
+ }
///
/// Richeista verifica update
///
@@ -197,17 +227,15 @@ namespace IOB_WIN
}
displayTaskAndLog("Minimized");
}
-#if false
try
{
// segnalo reboot (programma)...
- iobObj.callUrl(iobObj.urlReboot);
+ utils.callUrl(urlReboot);
}
catch (Exception exc)
{
lg.Error(string.Format("EXCEPTION in fase di chaimata URL di reboot:{0}{1}", Environment.NewLine, exc));
}
-#endif
displayTaskAndLog("Main Form OK");
}
///
@@ -299,7 +327,7 @@ namespace IOB_WIN
if (MPIP != "")
{
IPAddress address = IPAddress.Loopback;
- // check stato server (ping + pagina ALIVE)
+ // check stato server (SOLO PING!)
IPAddress.TryParse(MPIP, out address);
if (address != IPAddress.Loopback)
{