Solved

Pascal Dos Function Ping

Posted on 2004-04-29
2
287 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now