Solved

Pascal Dos Function Ping

Posted on 2004-04-29
2
302 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

695 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