I have an application that I am working on to help me work a little more efficiently at work (accomplish multiple tasks within the same interface)
One of the things that I do alot is telnet to a port to see if there is something listening on it. It's easy enough to just pop open a cmd shell and do it, however Id still like to be able to do it from my interface.
The current application that I am writing simply builds jdbc connection strings, I am currently working on learning whatever would be necessary to test the string itself, but for the moment I'll settle for checking if the db port is open and listening.
I have text boxes that hold the hostname, port number and schema/db name (depending on oracle or mssql).
I then have a rich text box that when a checkbox is checked should attempt to telnet to host on the specified server and the output should be visible in the rich text box.
I found some sample code, and altered it to my needs, but I cannot seem to get it to work the way id like.
Any advice?
I'm completely self taught at this point, if anything makes you go "NOOB!" please point it out, I would love to learn from my mistakes.
Thanks!
One of the things that I do alot is telnet to a port to see if there is something listening on it. It's easy enough to just pop open a cmd shell and do it, however Id still like to be able to do it from my interface.
The current application that I am writing simply builds jdbc connection strings, I am currently working on learning whatever would be necessary to test the string itself, but for the moment I'll settle for checking if the db port is open and listening.
I have text boxes that hold the hostname, port number and schema/db name (depending on oracle or mssql).
I then have a rich text box that when a checkbox is checked should attempt to telnet to host on the specified server and the output should be visible in the rich text box.
I found some sample code, and altered it to my needs, but I cannot seem to get it to work the way id like.
Any advice?
Code:
Private Sub telnet()
'Should construct and send the desired console command,
'and then redirec the output to a rich text box
Dim clsProcess As New System.Diagnostics.Process()
clsProcess.StartInfo.UseShellExecute = False
clsProcess.StartInfo.RedirectStandardOutput = True
clsProcess.StartInfo.RedirectStandardError = True
clsProcess.StartInfo.FileName = "cmd.exe"
clsProcess.StartInfo.Arguments = "telnet " & txtserver.Text & " " & txtport.Text
clsProcess.StartInfo.CreateNoWindow = True
clsProcess.Start()
While (clsProcess.HasExited = False)
Dim sLine As String = clsProcess.StandardOutput.ReadLine
If (Not String.IsNullOrEmpty(sLine)) Then
End If
rchPing.Text &= sLine & vbCrLf
Application.DoEvents()
End While
Me.rchPing.Text += "Completed"
End Sub
I'm completely self taught at this point, if anything makes you go "NOOB!" please point it out, I would love to learn from my mistakes.
Thanks!