Solved

Ping question

Posted on 1998-05-12
8
178 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 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 11

Expert Comment

by:alexo
Comment Utility
Put them both in one string and use it as one of the arguments.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:pcasxd0
Comment Utility
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
Comment Utility
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
Comment Utility
alexo,
Look for the question in this topic area to award you an equal number of points.


0
 
LVL 11

Expert Comment

by:alexo
Comment Utility
Thank you.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

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

6 Experts available now in Live!

Get 1:1 Help Now