?
Solved

Ping question

Posted on 1998-05-12
8
Medium Priority
?
184 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
[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
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
Technology Partners: 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

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