Solved

Pascal Dos Function Ping

Posted on 2004-04-29
2
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

The world seems to conceive of a curious bubble separating IT from “the business.”  More so than just about any other pursuit in the commercial world, people think of IT as some kind of an island.
Read the original post on Monitis Blog. Believe it or not, the most important thing about the website of your business is not what’s on it but how fast it loads. Yes, that’s right!    As you can see on this infographic (an oldie but goodie!), …

726 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