c++ ping program


 
Thread Tools Search this Thread
Top Forums Programming c++ ping program
# 1  
Old 12-28-2002
c++ ping program

i just finished a c++ course in my school and i want to write a program to use at home, also for my dad to use. my dsl has been going out recently and i check the connection by pinging yahoo.com usually. but the ping program times out after a little while of no responces. so what i want to do is this, write a c++ program where it will ask you what host you want to ping, and it will open the ping program. now if there is a responce, it will output the responce and then the program will end. if there is no responce in a given amount of time, like 5 seconds, it will kill the ping program and restart it and keep trying until a responce is recieved. i want to do this in c++ because i will want to compile this for windows so my dad can use it, the only access to any compiler is at school, and only c++. so my question is this, in c++ how can i call an outside program? i will specify in the program where to look for the program, (/bin/ping) and when i want to compile it for windows i will just change the location. ive done this in a shell script with bash, and thats what i use now for when the dsl goes out, but this is a personal project of mine to get this running and mainly so my dad can use it. this is not a homework question.
# 2  
Old 12-28-2002
You could always do this in Perl - in fact, there are answers in this forum on how to do it as I've helped to write a couple!

Smilie
# 3  
Old 12-28-2002
thank you. i will search your threads and post back when ive found the solution.
# 4  
Old 11-04-2006
i have got similiar problem.. i have created program, which has database of ip and mac address in wifi. wifi ap is controling ip and macs, so I need to change both. i have program that first prints all ips and macs to the screen, and than asks user for ip he want. after you enter ip, program configures all, and i am able to connect.

this is my problem: now i must first use nmap to check if my victim is online. if he is, i am not able to change my addresses to victim's. if his offline i can do it. so i want to change my program. it checks if victim is online, and prints it to screen. or just print only offline victims..

so i need PING for c++
# 5  
Old 11-04-2006
zero0x, read the rules.

Quote:
(11) These are not hacker boards so hacker related posts will be promptly deleted or moderated.
You won't get any help disrupting the connectivity of your victims on this site.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl program get a response before the program quits

I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade. I have: if ( $response =~ m/^/ ) { $user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies

2. Programming

Ping test sends mail when ping fails

help with bash script! im am working on this script to make sure my server will stay online, so i made this script.. HOSTS="192.168.138.155" COUNT=4 pingtest(){ for myhost in "$@" do ping -c "$COUNT" "$myhost" &&return 1 done return 0 } if pingtest $HOSTS #100% failed... (4 Replies)
Discussion started by: mort3924
4 Replies

3. Shell Programming and Scripting

How to get reason for ping failure using perls Net::Ping->new("icmp");?

Hi I am using perl to ping a list of nodes - with script below : $p = Net::Ping->new("icmp"); if ($p->ping($host,1)){ print "$host is alive.\n"; } else { print "$host is unreacheable.\n"; } $p->close();... (4 Replies)
Discussion started by: tavanagh
4 Replies

4. Shell Programming and Scripting

Animation Ping on Solaris Like Cisco Ping

Hi, I develop simple animation ping script on Solaris Platform. It is like Cisco ping. Examples and source code are below. bash-3.00$ gokcell 152.155.180.8 30 Sending 30 Ping Packets to 152.155.180.8 !!!!!!!!!!!!!.!!!!!!!!!!!!!!!. % 93.33 success... % 6.66 packet loss...... (1 Reply)
Discussion started by: gokcell
1 Replies

5. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

6. Programming

Python program faster than C++ program.

I wrote a simple program that generates a random word 10,000,000 times. I wrote it in python, then in C++ and compared the two completion times. The python script was faster! Is that normal? Why would the python script be faster? I was under the impression that C++ was faster. What are some of... (2 Replies)
Discussion started by: cbreiny
2 Replies

7. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

8. Programming

A program to trace execution of another program

Hi, I wanted to know if i can write a program using switches and signals, etc to trace execution of other unix program which calls c program internally. If yes how? If not with signals and switches then are there any other methods apart from debugging with gdb/dbx. (3 Replies)
Discussion started by: jiten_hegde
3 Replies

9. Programming

How to write to stdin of another program (program A -> [stdin]program B)

Hi, Program A: uses pipe() I am able to read the stdout of PROGAM B (stdout got through system() command) into PROGRAM A using: * child -> dup2(fd, STDOUT_FILENO); -> execl("/path/PROGRAM B", "PROGRAM B", NULL); * parent -> char line; -> read(fd, line, 100); Question: ---------... (1 Reply)
Discussion started by: vvaidyan
1 Replies

10. IP Networking

ping program with explanations please!!!!!

need help!! need a ping program written in c with the explanations as to what each variable,function does!!! please help!! (4 Replies)
Discussion started by: sachin_zeus
4 Replies
Login or Register to Ask a Question