Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. code for IP detection on LAN

code for IP detection on LAN

Scheduled Pinned Locked Moved C#
csharpcomhelp
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mitesh487
    wrote on last edited by
    #1

    hi, This is mitesh doing engineering in IT. I need help do to the project for finding out the IP Address on LAN. The code must be in C# preferably. If you can help please mail the code at mitesh_487@rediffmail.com thank you, please do it urgently.

    N J D 3 Replies Last reply
    0
    • M mitesh487

      hi, This is mitesh doing engineering in IT. I need help do to the project for finding out the IP Address on LAN. The code must be in C# preferably. If you can help please mail the code at mitesh_487@rediffmail.com thank you, please do it urgently.

      N Offline
      N Offline
      NeCroFire
      wrote on last edited by
      #2

      ClickME[^]

      1 Reply Last reply
      0
      • M mitesh487

        hi, This is mitesh doing engineering in IT. I need help do to the project for finding out the IP Address on LAN. The code must be in C# preferably. If you can help please mail the code at mitesh_487@rediffmail.com thank you, please do it urgently.

        J Offline
        J Offline
        Jack Li
        wrote on last edited by
        #3

        namespace NKUtilities
        {
        using System;
        using System.Net;

        public class DNSUtility
        {
            public static int Main (string \[\] args)
            {
            
              String strHostName = new String ("");
              if (args.Length == 0)
              {
                  // Getting Ip address of local machine...
                  // First get the host name of local machine.
                  strHostName = Dns.GetHostName ();
                  Console.WriteLine ("Local Machine's Host Name: " +  strHostName);
              }
              else
              {
                  strHostName = args\[0\];
              }
              
              // Then using host name, get the IP address list..
              IPHostEntry ipEntry = DNS.GetHostByName (strHostName);
              IPAddress \[\] addr = ipEntry.AddressList;
              
              for (int i = 0; i < addr.Length; i++)
              {
                  Console.WriteLine ("IP Address {0}: {1} ", i, addr\[i\].ToString ());
              }
              return 0;
            }    
         }
        

        }

        M D 2 Replies Last reply
        0
        • M mitesh487

          hi, This is mitesh doing engineering in IT. I need help do to the project for finding out the IP Address on LAN. The code must be in C# preferably. If you can help please mail the code at mitesh_487@rediffmail.com thank you, please do it urgently.

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #4

          mitesh_487 wrote:

          This is mitesh doing engineering in IT.

          And soon you will be working for some IT company without any knowledge. And flooding forums with "send me code" type questions.

          mitesh_487 wrote:

          I need help do to the project for finding out the IP Address on LAN. The code must be in C# preferably.

          Is this what you call help?

          mitesh_487 wrote:

          If you can help please mail the code at mitesh_487@rediffmail.com

          Great going. What do you expect to learn like this?

          Happy Holi[^] जय हिंद

          L 1 Reply Last reply
          0
          • J Jack Li

            namespace NKUtilities
            {
            using System;
            using System.Net;

            public class DNSUtility
            {
                public static int Main (string \[\] args)
                {
                
                  String strHostName = new String ("");
                  if (args.Length == 0)
                  {
                      // Getting Ip address of local machine...
                      // First get the host name of local machine.
                      strHostName = Dns.GetHostName ();
                      Console.WriteLine ("Local Machine's Host Name: " +  strHostName);
                  }
                  else
                  {
                      strHostName = args\[0\];
                  }
                  
                  // Then using host name, get the IP address list..
                  IPHostEntry ipEntry = DNS.GetHostByName (strHostName);
                  IPAddress \[\] addr = ipEntry.AddressList;
                  
                  for (int i = 0; i < addr.Length; i++)
                  {
                      Console.WriteLine ("IP Address {0}: {1} ", i, addr\[i\].ToString ());
                  }
                  return 0;
                }    
             }
            

            }

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            Jack - you're it is not recommended that you feed these idiots with code, see d@nishes post, it is quite relevant. Heaping scorn is a more appropriate answer. Giving a clue to where to look is even better eg point the idiot to the using System.Net; library, feeding an idiot code only encourages them.

            Never underestimate the power of human stupidity RAH

            1 Reply Last reply
            0
            • J Jack Li

              namespace NKUtilities
              {
              using System;
              using System.Net;

              public class DNSUtility
              {
                  public static int Main (string \[\] args)
                  {
                  
                    String strHostName = new String ("");
                    if (args.Length == 0)
                    {
                        // Getting Ip address of local machine...
                        // First get the host name of local machine.
                        strHostName = Dns.GetHostName ();
                        Console.WriteLine ("Local Machine's Host Name: " +  strHostName);
                    }
                    else
                    {
                        strHostName = args\[0\];
                    }
                    
                    // Then using host name, get the IP address list..
                    IPHostEntry ipEntry = DNS.GetHostByName (strHostName);
                    IPAddress \[\] addr = ipEntry.AddressList;
                    
                    for (int i = 0; i < addr.Length; i++)
                    {
                        Console.WriteLine ("IP Address {0}: {1} ", i, addr\[i\].ToString ());
                    }
                    return 0;
                  }    
               }
              

              }

              D Offline
              D Offline
              dan sh
              wrote on last edited by
              #6

              This way you are not helping the poster to learn. Hence I voted you down.

              Happy Holi[^] जय हिंद

              1 Reply Last reply
              0
              • D dan sh

                mitesh_487 wrote:

                This is mitesh doing engineering in IT.

                And soon you will be working for some IT company without any knowledge. And flooding forums with "send me code" type questions.

                mitesh_487 wrote:

                I need help do to the project for finding out the IP Address on LAN. The code must be in C# preferably.

                Is this what you call help?

                mitesh_487 wrote:

                If you can help please mail the code at mitesh_487@rediffmail.com

                Great going. What do you expect to learn like this?

                Happy Holi[^] जय हिंद

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                d@nish wrote:

                mitesh_487 wrote: If you can help please mail the code at mitesh_487@rediffmail.com Great going. What do you expect to learn like this?

                How to receive spam.

                Check out the CodeProject forum Guidelines[^]

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups