public void Arquire() { try { locals.Clear(); var brs = new NetworkBrowser(); foreach (string name in brs.getNetworkComputers()) { var tim = new Stopwatch(); tim.Start(); var ips = Dns.GetHostAddresses(name); tim.Stop(); var t = tim.Elapsed; locals.Add(new LocalUnit() { hostname = name, ipv4 = (from ip in ips where ip.AddressFamily == AddressFamily.InterNetwork select ip).FirstOrDefault(), ipv6 = (from ip in ips where ip.AddressFamily == AddressFamily.InterNetworkV6 select ip).ToArray(), latency = t, }); } } catch (Exception e) { MessageBox.Show("Error occured during arcquiring local computers", e.GetType().ToString(), MessageBoxButton.OK, MessageBoxImage.Error); } }
private void obtener_nombres_equipo_button_Click(object sender, EventArgs e) { NetworkBrowser nb = new NetworkBrowser(); List <string> lista = new List <string>(); foreach (string pc in nb.getNetworkComputers()) { dataGridView1.Rows.Add(pc); } }
static void Main(string[] args) { IniFile ini = new IniFile("C:\\users\\ade\\test.ini"); ini.IniWriteValue("marcha", "dos", "pescadores"); String readString = ini.IniReadValue("marcha", "dos"); System.Console.WriteLine("Hello " + readString); ArrayList networkComputers = new ArrayList(); NetworkBrowser nb = new NetworkBrowser(); networkComputers = nb.getNetworkComputers(); Console.WriteLine(networkComputers[0]); }
public DatabaseSettings(MySqlDB db) { InitializeComponent(); this.mySqlDb = db; try { NetworkBrowser nb = new NetworkBrowser(); foreach (string pc in nb.getNetworkComputers()){ cmbHost.Items.Add(pc); } } catch (Exception) { MessageBox.Show("An error occurred trying to access the network computers", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
public DatabaseSettings(MySqlDB db) { InitializeComponent(); this.mySqlDb = db; try { NetworkBrowser nb = new NetworkBrowser(); foreach (string pc in nb.getNetworkComputers()) { cmbHost.Items.Add(pc); } } catch (Exception ex) { MessageBox.Show("An error occurred trying to access the network computers", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
public static List <string> getLanHostnames() { var s_comps = new List <string>(); var nb = new NetworkBrowser(); var computers = nb.getNetworkComputers(); for (int i = 0; i < computers.Count; i++) { var o = computers[i]; if (o.ToString() == Environment.MachineName) { computers.RemoveAt(i); } } for (int i = 0; i < computers.Count; i++) { s_comps.Add(computers[i].ToString()); } return(s_comps); }
public static List<string> getLanHostnames() { var s_comps = new List<string>(); var nb = new NetworkBrowser(); var computers = nb.getNetworkComputers(); for (int i = 0; i < computers.Count; i++) { var o = computers[i]; if (o.ToString() == Environment.MachineName) { computers.RemoveAt(i); } } for (int i = 0; i < computers.Count; i++) { s_comps.Add(computers[i].ToString()); } return s_comps; }