Re: Performing Ping from within VB.Net

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ralph (nt_consulting32_at_hotmail.com)
Date: 05/12/04


Date: Wed, 12 May 2004 18:05:21 -0500


"Paul Clement" <UseAdddressAtEndofMessage@swspectrum.com> wrote in message
news:ud12a05gcvo13o7hhlbq5qb4p1k20samo4@4ax.com...
> On Tue, 11 May 2004 18:44:56 +0100, "Raf" <Nomail@noserver.no> wrote:
>
> ¤ Hello to the pros,
> ¤
> ¤ I have to create an application that performs a "Ping" to an IP-address.
The
> ¤ result (successfull or not successfull)
> ¤ should be captured by the application and should be shown to the user.
> ¤
> ¤ I know that you can perform dos-commands with the SHELL-command.
> ¤ But is there a possibility to catch the result of this ping-command if I
do
> ¤ it like this.
> ¤
> ¤ Does anyone have some suggestions?
>
> How to ping an IP address by using sockets in Visual Basic .NET
> http://support.microsoft.com/default.aspx?scid=kb;en-us;828993
>
>
> Paul ~~~ pclement@ameritech.net
> Microsoft MVP (Visual Basic)

Raf,

Paul's suggestion is the best road to take.

Just to amplify a bit - 'ping' is not a "dos command", it is actually a
Windows Console Application. (All the 'net' utilities fall into this
category as well) Console applications normally write information out to
their own, ... well, console. You can not capture their output thru normal
redirection. Nor by any other means, well that is, without writing your own
command console or command processor. (Let's just say it is not impossible,
just the next thing to it.

You can easily test if a particular 'command' is writing to std i/o (thus
easily captured) or not (not available) by simply entering the command in a
console and redirecting the output to a file. ( C: ping myserver >
pingfile ) Then open the file and see what's there. Anything sent to stdout
will appear in the file - anything not there has disappeared into the ether.

My advice - do what Paul suggests - use the socket API.

HTH
-ralph



Relevant Pages

  • Re: recommendations : image grabber, translator.
    ... > My apologies Steve: I was hasty. ... Having said that it does require a console ... capture whatever else you want. ... For all I know KDE might even have a "add command ...
    (alt.os.linux)
  • Re: mvs command execution using batch job
    ... command read from a console and reflects the reply to that console. ... you can capture anything that appears on that console. ... For properly-written command processors the program can supply a response ...
    (bit.listserv.ibm-main)
  • Console and user terminal activity monitoring
    ... Is there any method to capture the entire console activty as well as ... I am using AIX ... run, its output, errors etc and who executed the command. ...
    (comp.unix.aix)
  • Win32: Output to console
    ... I'm using Perl on a windows machine to automate Visual Studio .NET C++ ... The command I run is the VS commandline program ... capture or redirect this output to the console when I run the command ... This does capture the output, but doesn't print it out until the ...
    (comp.lang.perl.misc)
  • Re: finding a fax in the fax console?
    ... The command line is for the Open command for TIF files. ... > I am still unable to view any faxes from the console. ... >>>>Inbox to the Outlook Inbox. ...
    (microsoft.public.outlook.fax)