Solved

Pascal Dos Function Ping

Posted on 2004-04-29
2
297 Views
Last Modified: 2006-11-17
Hi everyone,
i'm making a program to ping a bunch of ip adresses, it's for a network, so i made a procedure to get the adresses to ping, and i know how to ping them via dos and so on ...

   SwapVectors;
   Exec(GetEnv('COMSPEC'), Commands^[i]);
   SwapVectors;

but i would like to know, if there is a way of knowing wether the ping did succeed, or if it did fail, i can't get that via DosError or DosExitCode,

i want my program to ping them and then give a logfile with the pings that did succeed, the ones who did not succeed and so on
can someone help me ou of that ?
thanks to anyone in advance

Elvis
0
Comment
Question by:Elvis1
2 Comments
 
LVL 6

Accepted Solution

by:
MannSoft earned 75 total points
ID: 10952961
You could try piping the output of the ping command to a text file, and then you could parse the file to determine if it succeeded or failed.  So the code might look like:

  SwapVectors;
  Exec(GetEnv('COMSPEC'), Commands^[i] + ' >> TEMP.TXT');
  SwapVectors;
  // Here you should call a function to read TEMP.TXT and determine the results
  // And then you should delete the temp file

The hardest part here will be writing the function to parse the file, but it shouldnt be too bad.  Just check each line for "Reply from" or whatever string is used when a ping fails.  If it doesn't find either, then just ignore that line.  If it finds one or the other, then that's a line you can use to determine if the ping succeeded.
0
 

Author Comment

by:Elvis1
ID: 10962937
Thanks A Lot, it's i great,
thank you verry much

Elvis1
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question