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 to get ip of remote machine in a LAN

how to get ip of remote machine in a LAN

Scheduled Pinned Locked Moved C#
csharphelptutorial
6 Posts 3 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.
  • A Offline
    A Offline
    Ajithevn
    wrote on last edited by
    #1

    if i have a c# application.exe installed in a remote system can i get the ip of that system if yes plz help me

    H C 2 Replies Last reply
    0
    • A Ajithevn

      if i have a c# application.exe installed in a remote system can i get the ip of that system if yes plz help me

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

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

      <Edit> oops, only just saw you wanted remote machine. In that case just specify the HostName instead of Environment.MachineName like so...

      System.Net.IPAddress[] myIpAddresses = System.Net.Dns.GetHostAddresses("SomeComputer");

      </Edit> <Edit2> OMG, i think I'm experiencing dyslexia!! If you want to run the app remotely and get its machines IP use the 1st snippet, but like CG said it needs to be sent somewhere... If you have the remote machines HostName you can use the 2nd snippet on the local machine. </Edit2>

      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

      modified on Monday, September 7, 2009 5:22 AM

      A 1 Reply Last reply
      0
      • A Ajithevn

        if i have a c# application.exe installed in a remote system can i get the ip of that system if yes plz help me

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Yes, if you write an app that runs on that remote machine, it can read and broadcast the IP address if you like. Of course, it needs somewhere to send it.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        1 Reply Last reply
        0
        • H Harvey Saayman

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

          <Edit> oops, only just saw you wanted remote machine. In that case just specify the HostName instead of Environment.MachineName like so...

          System.Net.IPAddress[] myIpAddresses = System.Net.Dns.GetHostAddresses("SomeComputer");

          </Edit> <Edit2> OMG, i think I'm experiencing dyslexia!! If you want to run the app remotely and get its machines IP use the 1st snippet, but like CG said it needs to be sent somewhere... If you have the remote machines HostName you can use the 2nd snippet on the local machine. </Edit2>

          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

          modified on Monday, September 7, 2009 5:22 AM

          A Offline
          A Offline
          Ajithevn
          wrote on last edited by
          #4

          i need to find out all the machines running the application.exe how is that possible

          H 1 Reply Last reply
          0
          • A Ajithevn

            i need to find out all the machines running the application.exe how is that possible

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

            Have application.exe get the IP address, and write it into a SQL database. That would be the easiest way to do it...

            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

            A 1 Reply Last reply
            0
            • H Harvey Saayman

              Have application.exe get the IP address, and write it into a SQL database. That would be the easiest way to do it...

              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

              A Offline
              A Offline
              Ajithevn
              wrote on last edited by
              #6

              is it possible to use dataset in place of sql database, but i dont know how to transfer data from one machine to another using datasets.can u help me

              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