Breaking News
Sunday, 6 July 2014

How to get ip address of the all LAN computers.

Download Project :
To get the ip address of the all the computer which is connected to the local area network . code:

·         there is a way to get ip address there is dll also available which is returns the ip address and computer name which is connecter to your network.
·         Download DLL From :  GetLaneIpAddress_Nirav_Daraniya
                How to use DLL in your application
a.       First take one windows form, and then drag and drop the button control to it and also list box control to form control.
b.      Now add dll to the project, this DLL is can not take any argument but its class name is “Class1” and it will return the Hash table.
c.       Code:
Add namespace in project
Imports GetLaneIpAddress_Nirav_Daraniya

Make object of the class which is define in DLL

Dim objClass1 As New Class1

Now generate button click event on your project
private void button1_Click(object sender, EventArgs e)
              Dim aaaa As Hashtable
              aaaa = sss.getIPAddress()

              Foreach DictionaryEntry child In aaaa
ListBox1.Items.Add("PC Name : " + child.Key + "   IP Address : " + child.Value)



             *** if you want to do same possess via code then follow this steps.

1.       first you have to a namespace
              using System.IO;
using System.Net;
using System.Net.NetworkInformation;

2.       now .
                         Process netUtility = new Process();

            netUtility.StartInfo.FileName = "net.exe";

            netUtility.StartInfo.CreateNoWindow = true;

            netUtility.StartInfo.Arguments = "view";

            netUtility.StartInfo.RedirectStandardOutput = true;

            netUtility.StartInfo.UseShellExecute = false;

            netUtility.StartInfo.RedirectStandardError = true;


StreamReader streamReader =StreamReader(netUtility.StandardOutput.BaseStream,                       netUtility.StandardOutput.CurrentEncoding);

3.       now make loop
                                string line = "";

              while ((line = streamReader.ReadLine()) != null)
                if (line.StartsWith("\\"))
string myIP = Convert.ToString(System.Net.Dns.GetHostByName(line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper()).AddressList[0].ToString());


See Also :
  Follow Me On Facebook

/\/ir@\/  <(.'.)>


Thanks for comment

Toggle Footer