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. How can I get the local machine's IP address in a Windows app ?

How can I get the local machine's IP address in a Windows app ?

Scheduled Pinned Locked Moved C#
question
6 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.
  • R Offline
    R Offline
    Rahad Rahman
    wrote on last edited by
    #1

    How can I get the local machine's IP address in a Windows app ?

    L C H L C 5 Replies Last reply
    0
    • R Rahad Rahman

      How can I get the local machine's IP address in a Windows app ?

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

      Finding IP Address Information[^]

      1 Reply Last reply
      0
      • R Rahad Rahman

        How can I get the local machine's IP address in a Windows app ?

        C Offline
        C Offline
        Calla
        wrote on last edited by
        #3

        Did you even try Google before posting this..? :|

        1 Reply Last reply
        0
        • R Rahad Rahman

          How can I get the local machine's IP address in a Windows app ?

          H Offline
          H Offline
          Harvey Saayman
          wrote on last edited by
          #4

          System.Net.IPAddress[] MyIPs = System.Net.Dns.GetHostAddresses(Environment.MachineName);

          Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

          1 Reply Last reply
          0
          • R Rahad Rahman

            How can I get the local machine's IP address in a Windows app ?

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi, All previous replies lead to your local IP address, i.e. the address as seen on your LAN; when connecting to the Internet, the outside world may see you at a different address though, and you need an external server to tell you that address, have a look here[^]. :)

            Luc Pattyn


            Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


            Local announcement (Antwerp region): Lange Wapper? Neen!


            1 Reply Last reply
            0
            • R Rahad Rahman

              How can I get the local machine's IP address in a Windows app ?

              C Offline
              C Offline
              carlecomm
              wrote on last edited by
              #6

              // //IP // System.Net.IPAddress[] addressList = Dns.GetHostByName (Dns.GetHostName()).AddressList; for (int i = 0; i < addressList.Length; i ++) { s += addressList[i].ToString(); }

              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