ping my LAN

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Smurfas
    New Member
    • Jul 2008
    • 30

    ping my LAN

    Hi,
    I wish see what is online in my LAN(workgroup).
    How I can see another computer IP in my LAN or another information

    I guess I could try pinging all the IP addresses in your LAN address range, but how?






    Sorry for bad english grammar :[
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Figure out what your IP addresses are for your LAN (Probably a 192.168.x.y). Then itterate through all the values of y (1-254) and see who responds?

    Comment

    • Smurfas
      New Member
      • Jul 2008
      • 30

      #3
      Originally posted by Plater
      Figure out what your IP addresses are for your LAN (Probably a 192.168.x.y). Then itterate through all the values of y (1-254) and see who responds?
      Yes, I now, but how make program this with C#.
      How scan lan with C#?

      Comment

      • Daxthecon
        New Member
        • Jul 2008
        • 63

        #4
        Start -> Run -> cmd -> Ok -> ping -t 192.168.1.101

        increment the X to the next number till the ping no longer responds.

        If you want to right a program in C# that does this use www.google.com and search for C# Lan View.

        Comment

        • Smurfas
          New Member
          • Jul 2008
          • 30

          #5
          Originally posted by Daxthecon
          Start -> Run -> cmd -> Ok -> ping -t 192.168.1.101

          increment the X to the next number till the ping no longer responds.

          If you want to right a program in C# that does this use www.google.com and search for C# Lan View.
          I very long searching in google, but nothing found.

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            Originally posted by Smurfas
            I very long searching in google, but nothing found.
            I don't think you searched at all.
            .Net HAS a Ping class (System.Net.Net workInformation .Ping) that cane be used to perform ping operations.

            Comment

            • Curtis Rutland
              Recognized Expert Specialist
              • Apr 2008
              • 3264

              #7
              Originally posted by Smurfas
              I very long searching in google, but nothing found.
              O RLY?

              Google: C# Ping
              First result:
              Allows an application to determine whether a remote computer is accessible over the network.

              Comment

              • Smurfas
                New Member
                • Jul 2008
                • 30

                #8
                Originally posted by insertAlias
                Thanks, but this program testing my ping(only my PC).
                This program don't send ping all my lan. I say or not true?

                I need program source(C# sample), who make like this program:
                Provide instant remote tech support to corporate network users with Radmin. Gain secure remote access to network computers and servers.

                Comment

                • Plater
                  Recognized Expert Expert
                  • Apr 2007
                  • 7872

                  #9
                  Originally posted by Smurfas
                  Thanks, but this program testing my ping(only my PC).
                  This program don't send ping all my lan. I say or not true?

                  I need program source(C# sample), who make like this program:
                  http://www.radmin.com/products/utilities/lanscanner.php
                  I already told you what to do.
                  Iterate through your ip address range values, using PING.
                  If you had a domain controller, you could do it much "nicer" way.

                  Comment

                  • Curtis Rutland
                    Recognized Expert Specialist
                    • Apr 2008
                    • 3264

                    #10
                    No, this example lets you ping any address you want, not just localhost. Note that args[0] in this example contains an ip address in it. So if you define your own IPAddress instead of args[0] you can specify the address in code.

                    Example: (using the same code as the MSDN example but adding my own chosen IP Address.
                    Code:
                    IPAddress address = IPAddress.Parse("192.168.20.1");
                    PingReply reply = pingSender.Send (address, timeout, buffer, options);
                    Plater has told you to iterate through all your IP addresses, and the MSDN page I sent you to shows you how to ping one address. So, knowing this, you should logically be able to modify the example to ping multiple addresses. It should even be easy enough to put in textboxes in your program to define start and stop ranges.

                    Comment

                    • Smurfas
                      New Member
                      • Jul 2008
                      • 30

                      #11
                      I have one program:
                      [code=c#]
                      using System;
                      using System.Net;
                      using System.Net.Netw orkInformation;
                      using System.Text;

                      namespace Examples.System .Net.NetworkInf ormation.PingTe st
                      {
                      public class PingExample
                      {
                      // args[0] can be an IPaddress or host name.
                      public static void Main(string[] args)
                      {
                      string server = "127.0.0.1" ;//address to verify, like 127.0.0.1
                      IPAddress ipa = IPAddress.Parse (server);
                      Ping p = new Ping();
                      PingReply reply;
                      reply = p.Send(server);
                      int success = 0, insuccess = 0;
                      for (int i = 0; i < 4; i++)
                      {
                      reply = p.Send(ipa);
                      if (reply.Address == ipa)
                      success++;
                      else
                      insuccess++;
                      Console.WriteLi ne("Pack. sent");
                      }
                      Console.WriteLi ne("sent = 4, recived = {0}, lost = {1}", success, insuccess);
                      Console.ReadKey ();
                      }
                      }
                      }[/code]

                      But why always ping not work, send =4, recived = 0, lost = 4
                      Last edited by Plater; Jul 17 '08, 12:55 PM. Reason: code tags

                      Comment

                      • BageDevimo
                        New Member
                        • Jul 2008
                        • 10

                        #12
                        That usually means no packets where recieved from the computer you pinged..

                        Like, when I ping 127.0.0.1 (which exists) I get:
                        Sent = 4, Received = 4, Lost = 0
                        But when I ping 10.1.1.5 (not a pc on my network) i get:
                        Sent = 4, Received = 0, Lost = 4
                        Because no computer has responded to my ping request.
                        So basically if you get Sent 4, recv 4 then you've got a PC there, else there is nothing at that IP.

                        Ben Anderson,

                        Comment

                        • Curtis Rutland
                          Recognized Expert Specialist
                          • Apr 2008
                          • 3264

                          #13
                          Originally posted by Smurfas
                          Code:
                          reply = p.Send(ipa);
                          if (reply.Address == ipa)
                            success++;
                          else
                            insuccess++;
                          But why always ping not work, send =4, recived = 0, lost = 4
                          This isn't the correct way to test if you had a successful ping. Use:
                          Code:
                          if(reply.Status == IPStatus.Success)
                          I think that the other way, you aren't comparing the actual values, but the reference.

                          Comment

                          • Curtis Rutland
                            Recognized Expert Specialist
                            • Apr 2008
                            • 3264

                            #14
                            Originally posted by BageDevimo
                            That usually means no packets where recieved from the computer you pinged..

                            Like, when I ping 127.0.0.1 (which exists) I get:
                            Sent = 4, Received = 4, Lost = 0
                            But when I ping 10.1.1.5 (not a pc on my network) i get:
                            Sent = 4, Received = 0, Lost = 4
                            Because no computer has responded to my ping request.
                            So basically if you get Sent 4, recv 4 then you've got a PC there, else there is nothing at that IP.

                            Ben Anderson,
                            There is always something at 127.0.0.1
                            There is some other problem there. Likely the coding error I pointed out there, or a firewall blocking the ping requests.

                            Comment

                            • Plater
                              Recognized Expert Expert
                              • Apr 2007
                              • 7872

                              #15
                              Originally posted by insertAlias
                              There is always something at 127.0.0.1
                              There is some other problem there. Likely the coding error I pointed out there, or a firewall blocking the ping requests.
                              Somewhere in XP there is an option to not respond to icmp requests. It might also not respond to requests on the loopback interface.

                              Comment

                              Working...