473,324 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Tracert for multiple connections VB.NET

Hi,

I currently have some basic code that allows me to run the tracert
command through VB.NET and it also updates my database based on the
results.

I was wondering if someone can help me find a way that I can used my
code to run tracert on mutiple instances at the same time. The
following is my current code.

Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStart.Click
' start NT tracert command
Dim ExeFileName As String
Dim Arguments As String
ExeFileName = "tracert"
Arguments = txtRoute.Text & " -h 5"
Dim s As String
Dim p As New Process
With p.StartInfo
.WorkingDirectory = "C:\windows\system32"
.FileName = ExeFileName
.Arguments = Arguments
.UseShellExecute = False
.RedirectStandardError = True
.RedirectStandardInput = True
.RedirectStandardOutput = True
.WindowStyle = ProcessWindowStyle.Hidden
.CreateNoWindow = True
End With
Try
p.Start()
s = p.StandardOutput.ReadToEnd()
p.WaitForExit()
Catch ex As Exception
s = ex.ToString
End Try
p.Dispose()
Dim test As String
Dim r As Integer
Dim rtimout As Single
Dim sever As Single
Dim devicname As String
Dim alrstr As String
'Determine Link State; FSO, Radio, Both connections down
rtimout = 0
test = s.ToString
r = test.IndexOf("192.168.101.2")
If r 0 Then
lblStatus.Text = "STATUS: Link to CORP is FSO"
sever = 1
devicname = "FSO"
alrstr = "Primary Route FSO is UP"
SqlSelectInsert(sever, devicname, alrstr)
ElseIf Not r 0 Then
r = test.IndexOf("192.168.11.21")
If r 0 Then
lblStatus.Text = "STATUS: Link to CORP is Radio"
sever = 2
devicname = "Radio"
alrstr = "Secondary Route Radio is UP, FSO down"
SqlSelectInsert(sever, devicname, alrstr)
ElseIf Not r 0 Then
r = test.IndexOf("timed out")
lblStatus.Text = "STATUS: Link is Down"
If r 0 Then
sever = 3
devicname = "NetworkDown"
alrstr = "The Network is Down Between CPD and
CORP"
SqlSelectInsert(sever, devicname, alrstr)
End If
End If
End If
'MessageBox.Show(s.ToString())
End Sub
Public Function SqlSelectInsert(ByVal sever As String, ByVal
devicname As String, ByVal alrstr As String) As String
'Create SQL Connection
Dim sqlResult As String
Dim sqlCon As New System.Data.SqlClient.SqlConnection
Dim sConnStr As String
sConnStr = "server=chmegavisonsrv
\nmssse;uid=test;pwd=test12345;database=test_MegaV ision"
sqlCon.ConnectionString = sConnStr
' Query the database before making and entry
sqlCon.Open()
Dim sqlcommand As New System.Data.SqlClient.SqlCommand
sqlcommand.CommandType = CommandType.StoredProcedure
sqlcommand.CommandText = "dbo.Select_LastRouteEntry"
sqlcommand.Connection = sqlCon
Dim sqlDataReader As System.Data.SqlClient.SqlDataReader
sqlDataReader = sqlcommand.ExecuteReader
If sqlDataReader.HasRows Then
While sqlDataReader.Read
sqlResult =
sqlDataReader.GetString(sqlDataReader.GetOrdinal(" devname"))
End While
End If
sqlCon.Close()
If Not devicname = sqlResult Then
sqlCon.Open()
Dim sqlCommand2 As New System.Data.SqlClient.SqlCommand
sqlCommand2.CommandType = CommandType.StoredProcedure
sqlCommand2.CommandText = "dbo.Insert_Route_Info"
sqlCommand2.Connection = sqlCon
sqlCommand2.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@sever", sever))
sqlCommand2.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@devname", devicname))
sqlCommand2.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@alrstr", alrstr))
sqlCommand2.ExecuteNonQuery()
sqlCon.Close()
End If
Return True
End Function
Apr 5 '08 #1
0 1236

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: carramba | last post by:
Hi! Iam runing php on win32.. and Iam wondering if there is enyposibility to run tracert in php? if yes how should I do it? -- just keep swiming
1
by: Paul Bergson | last post by:
I need to code a tracert function from an asp page. I can write some asp but I'm saddled with notepad as my development suite. Any pointers on getting a tracert type function from within asp? ...
4
by: Just D. | last post by:
We all know that we can use TRACERT as a standalone application in Windows to get a whole way of IP nodes to go through. I need to implement almost same feature from my own application. What's the...
9
by: Abhishek Srivastava | last post by:
Hello All, In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated...
2
by: Kishan Hathiwala | last post by:
how do i make tracert command in .net without using 3rd party software?
2
by: Adrian | last post by:
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...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
2
by: whitethomas12 | last post by:
Hi, I currently have some basic code that allows me to run the tracert command through VB.NET and it also updates my database based on the results. I was wondering if someone can help me...
1
by: Gabriel Genellina | last post by:
En Tue, 30 Sep 2008 03:53:21 -0300, cindy jones <mailcindy@gmail.com> escribió: Use the subprocess module: import subprocess host = 'www.microsoft.com' p = subprocess.Popen(,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.