[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 689
  • Last Modified:

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:####
0
lrbrister
Asked:
lrbrister
  • 3
  • 2
1 Solution
 
wrmichaelCommented:
mystring.indexOf("server:###") > 0

is what you are looking for.
0
 
wrmichaelCommented:
maybe even mystring.toUpper.indexOf(....
0
 
lrbristerAuthor Commented:
wrmichael,
  I have no frame of reference for what you posted.
How would I get mystring?
0
 
wrmichaelCommented:
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:

http://www.vbforums.com/showthread.php?549612-RESOLVED-Vb-net-2008-Using-Netstat

and

http://www.codeproject.com/Articles/3672/Netstat-Example

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?
0
 
lrbristerAuthor Commented:
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now