Ping and Tracert

A

Adrian

Hi
I need a VB dotnet ping and tracert GUI utility written in VB.net 2003
(not 2005).

I was sure there would have been many working examples for ping but I cannot
find any :(
I was hoping to find one I could just add to my app as there is no point in
reinventing the wheel! I could live without the tracert, but I do need it to
run from a windows form.

any links

thanks
 
C

Cor Ligthert [MVP]

Adrian,

Almost all my samples are in VBNet code, this one I have only in C#, can you
use this.
(at least 80% is almost exactly the same in VBNet)


Process p = new Process();
ProcessStartInfo pi = new ProcessStartInfo();
pi.UseShellExecute = false;
pi.RedirectStandardOutput = true;
pi.Arguments = "www.google.com";
pi.WorkingDirectory = "C:\\windows\\system32";
//this for nt* computers
pi.FileName = "ping";
p.StartInfo = pi;
p.Start();
System.IO.StreamReader sr = p.StandardOutput;
System.Text.StringBuilder sb = new System.Text.StringBuilder("");
int input = sr.Read();
while (input != -1)
{
sb.Append((char) input);
input = sr.Read();
}
MessageBox.Show(sb.ToString());

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top