• 0

[VBSCRIPT ]check if TCP port is open


Question

Hi,

I have a problem: I have a script that needs to check if a tcp port is used. if its not used it shall start a program, if the port is used it should do nothing.

The tcp port I want to check is 5555.

I read something about winsock but didnt really get anywhere :s.

I could do it by using the netstat ?command and put the output in a file but thats taking to long as it needs to be done under 300ms (milisecounds).

thx in advance!

Link to comment
https://www.neowin.net/forum/topic/337251-vbscript-check-if-tcp-port-is-open/
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I don't believe plain-old VBscript is capable of network I/O by itself... perhaps you meant VB?

One question though: is the TCP port you are checking local or remote? If it's local, you can simply use Winsock and try to bind to that port--if you can't bind to it, then the port is in use.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

  • Recent Achievements

    • First Post
      James courage Tabla earned a badge
      First Post
    • Reacting Well
      James courage Tabla earned a badge
      Reacting Well
    • Apprentice
      DarkShrunken went up a rank
      Apprentice
    • Dedicated
      CHUNWEI earned a badge
      Dedicated
    • Collaborator
      DarkShrunken earned a badge
      Collaborator
  • Popular Contributors

    1. 1
      +primortal
      382
    2. 2
      +FloatingFatMan
      177
    3. 3
      ATLien_0
      174
    4. 4
      snowy owl
      169
    5. 5
      Xenon
      134
  • Tell a friend

    Love Neowin? Tell a friend!