Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
how would i do something like this im useing dev-c++
EX:for (int i=number; i255; i++)
system ("ping 192.168.1."i); // this part i dont know how to get the number there ? thx

It's pretty easy to do, but what is your purpose for having a C++ program that issues a bunch of ping commands. Given that you won't see the results, what's the point??
I can't think of any 'productive' use.

Before the loop:
char buffer[50];
Inside the loop:sprintf(buffer,"ping 192.168.1.%d",i);
system(buffer);sprintf() is like fprintf() except that it writes it's output to the memory pointed to by the first parameter instead of to a file.

When I am online using my dial-up connection, my firewall is constantly blocking ping requests. In less than one hour, it will usually receive close to two hundred such requests! They come from different I.P. addresses but all of the I.P.'s are originating from the same general location.
I'm not convinced that gorf has no ulterior motives in wanting to know how to accomplish this task.
Why would someone want to send so many requests? Is this likely an attempt to burn up a hosting company's bandwidth? What would happen if my firewall let my computer respond to these pings? Anyone have any thoeries or knowledge about this subject?

Actually using c++ to loop ping commands is a great way to attack servers or unprotected IP addresses. Ask CNN when a "hacker" used this technique to flood their system with pings....it couldn't handle so many because the computer is forced to answer every ping.........

I see no productive need for this pinging loop... especially when one ping to a particular IP is all you need for any valid testing procedure, local or remote.
Sounds like a "wanna-be hacker" toy to me, denial of service tool... etc. Well, I need not point fingers, I don't know the intentions here, but chances are... they are not productive.
IR

clicks my memories!!
i was attempting to write a batch file that uses a for loop to invoke the "net send" command to send messges to all subnets in my campus network in a single click! now that time is on my side, i try that again!
thanks folks!

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |