473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ping my LAN

30
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 :[
Jul 16 '08 #1
16 5524
Plater
7,872 Expert 4TB
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?
Jul 16 '08 #2
Smurfas
30
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#?
Jul 16 '08 #3
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.
Jul 16 '08 #4
Smurfas
30
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.
Jul 16 '08 #5
Plater
7,872 Expert 4TB
I very long searching in google, but nothing found.
I don't think you searched at all.
.Net HAS a Ping class (System.Net.NetworkInformation.Ping) that cane be used to perform ping operations.
Jul 16 '08 #6
Curtis Rutland
3,256 Expert 2GB
I very long searching in google, but nothing found.
O RLY?

Google: C# Ping
First result:
http://msdn.microsoft.com/en-us/libr...tion.ping.aspx
Jul 16 '08 #7
Smurfas
30
O RLY?

Google: C# Ping
First result:
http://msdn.microsoft.com/en-us/libr...tion.ping.aspx
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
Jul 16 '08 #8
Plater
7,872 Expert 4TB
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.
Jul 16 '08 #9
Curtis Rutland
3,256 Expert 2GB
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.
Expand|Select|Wrap|Line Numbers
  1. IPAddress address = IPAddress.Parse("192.168.20.1");
  2. PingReply reply = pingSender.Send (address, timeout, buffer, options);
  3.  
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.
Jul 16 '08 #10
Smurfas
30
I have one program:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Net;
  3. using System.Net.NetworkInformation;
  4. using System.Text;
  5.  
  6. namespace Examples.System.Net.NetworkInformation.PingTest
  7. {
  8.     public class PingExample
  9.     {
  10.         // args[0] can be an IPaddress or host name.
  11.         public static void Main(string[] args)
  12.         {
  13.             string server = "127.0.0.1";//address to verify, like 127.0.0.1
  14.             IPAddress ipa = IPAddress.Parse(server);
  15.            Ping p = new Ping();
  16.             PingReply reply;
  17.             reply = p.Send(server);
  18.             int success = 0, insuccess = 0;
  19.             for (int i = 0; i < 4; i++)
  20.             {
  21.                reply = p.Send(ipa);
  22.                if (reply.Address == ipa)
  23.                     success++;
  24.                 else
  25.                    insuccess++;
  26.                 Console.WriteLine("Pack. sent");
  27.             }
  28.            Console.WriteLine("sent = 4, recived = {0}, lost = {1}", success, insuccess);
  29.            Console.ReadKey();
  30.         }
  31.     }
  32. }
But why always ping not work, send =4, recived = 0, lost = 4
Jul 17 '08 #11
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,
Jul 17 '08 #12
Curtis Rutland
3,256 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. reply = p.Send(ipa);
  2. if (reply.Address == ipa)
  3.   success++;
  4. else
  5.   insuccess++;
  6.  
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:
Expand|Select|Wrap|Line Numbers
  1. if(reply.Status == IPStatus.Success)
  2.  
I think that the other way, you aren't comparing the actual values, but the reference.
Jul 17 '08 #13
Curtis Rutland
3,256 Expert 2GB
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.
Jul 17 '08 #14
Plater
7,872 Expert 4TB
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.
Jul 17 '08 #15
Yea, I think its part of the Firewall. SpyBot Search and Destory disables it too, well, if you get TeaTimer.exe anyway.

Meh, doesn't bother me, it's always worked for me. :D

Ben Anderson,
Jul 17 '08 #16
I have Spybot Teatimer on all the laptops in my apartment(friends are computer illeterate with that stuff) as well as AVG for free. Before I start data transfers from there computers(media stuff) I ping them to see so that vista doesn't crash itself. Defualt installs with slight IE modifications and the ping test still work. They are running XP as well.
Jul 17 '08 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jason Rodman | last post by:
I have downloaded every example on how to create a ping utility in .Net in both VB and C#, but have been disappointed with the results. I have YET to find an example that returns consistent results...
9
by: Mantorok | last post by:
Hi all I want to ping an ipaddress/host to check for a response. Is there any easy way in C#/.Net to do this? Thanks Kev
2
by: Eric Wenger | last post by:
I'm pretty new to C# and I'm trying to do what I believe should be a simple thing. I want to modify a program that is using the System.Net.NetworkInformation.Ping class to have some custom...
0
by: Ed | last post by:
I've attached some VB.NET code I've hacked together (some taken from MS examples & newsgroup postings) that will perform a ping or IcmpSendEcho using the icmp.dll (see this for more info:...
0
by: scotty | last post by:
I need to do a ping scan of a subnet. I can Enum through the IPs and do this, but it takes over 5 minutes as I can only create 1 process at a time. Does anyone know how I can create multiple Ping...
21
by: Neel | last post by:
I am trying to "ping" a remote host in my C++/Redhat Linux code to check whether that host is connected or not. if (0 == system("ping -w 2 192.168.0.2)) But, in both cases...
5
by: Deepak | last post by:
I am programing a ping application which pings various centers . I used timer loop and it pings one by one. Now when i finish pinging one center it should wait for the ping_completed function to...
1
by: Krish | last post by:
All, I have an offline application that works online for some data syncronization. For data syncronization I access a webservice. I want to show whether my application is online or not by checking...
3
by: imughal | last post by:
I got the perl script which does following task. This solution reads in a line from a text file that is passed in as input parameter 1 to a Perl script. This script will then ping the machine...
6
by: Dave Marden | last post by:
I currently use this routine in vbscript to ping computers and get the status of ping to determine whether to try to backup a machine, I am trying to change it to work with vb2003.net I am...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.