[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Ping question

Posted on 1998-05-12
8
Medium Priority
?
186 Views
Last Modified: 2010-04-10
I have an IP address. If I want to ping it, can I do it by using 'WinExec' or 'ShellExecute' in my program? That is, without having to write the ping functionality myself? I just want to get the ping response time, and some simple data like that. How should I go about doing this?
Thanks.
0
Comment
Question by:pcasxd0
8 Comments
 
LVL 7

Accepted Solution

by:
faster earned 300 total points
ID: 1176393
of course you can Exec a command and redirect the output to a file, then parse the file to get what you want.  Most of your code will be spent on parsing.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1176394
Although, if you use a Win32 platform, CreateProcess() is the correct way to go.  It also gives you more flexibility.
0
 

Author Comment

by:pcasxd0
ID: 1176395
I tried to use CreateProcess(), with my IP address as the lpApplicationName parameter and "ping" as the lpCommandLine parameter, with all the other parameters default. But I am getting an unhandled exception. Any ideas?
Thanks
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:alexo
ID: 1176396
Put them both in one string and use it as one of the arguments.
0
 

Author Comment

by:pcasxd0
ID: 1176397
Thanks, I realized that that is what I have to do, after I added the comment. I am increasing the points to 100, so that alexo, who also helped me gets points. Please give the experts 50 points each. Thanks again.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1176398
Duh!  You just gave fater 100 points and zero to me.
The process of grading is fully automated.  It is impossible to divide the points between experts.  "There can be only one"...
The usual approach is either to create a dummy question titled "for <name> only" containing text such as "for your help in question <...>".
Otherwise, you can ask Linda from customer support to do some creative point juggling (ask a 0-point question in the "experts exchange" forum).
0
 
LVL 7

Expert Comment

by:linda101698
ID: 1176399
alexo,
Look for the question in this topic area to award you an equal number of points.


0
 
LVL 11

Expert Comment

by:alexo
ID: 1176400
Thank you.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

834 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