VB code to see if netstat foreign address is open

I need some vb code to see if a netstat foreign address exists

In otherwords, I want to see if there is a foreign address that is = servername:####
Larry Bristersr. DeveloperAsked:
Who is Participating?
Wayne MichaelConnect With a Mentor Senior Software DeveloperCommented:
Your question is very vague so I wasn't sure at what level you need help.
Are you planning to use netstat and save the results then read those results or are you wanting a program written that acts like netstat and checks the results?

you might look at examples like this:




it could become complicated.

but if you just take a netstat and save the results to a file and then parse those results for your specific string it should not be too bad.

when you say server:####   do you know what numbers you are looking for?   maybe an example of the output from netstat would also help.

Also are you really wanting to know if it exists or a list of the ones that exist?
Wayne MichaelSenior Software DeveloperCommented:
mystring.indexOf("server:###") > 0

is what you are looking for.
Wayne MichaelSenior Software DeveloperCommented:
maybe even mystring.toUpper.indexOf(....
Larry Bristersr. DeveloperAuthor Commented:
  I have no frame of reference for what you posted.
How would I get mystring?
Larry Bristersr. DeveloperAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.