How can I wait for a TCP/IP port to be free or taken?

asked 14 Sep '11, 04:53

Jake's gravatar image

Jake ♦♦
826222226235
accept rate: 98%


The 'waitForPort' action is useful to wait to a service is started or stopped. This action pause the installation for a maximum timeout until a server process is listening in the specified port. For example:

<project>
    ...
    <runProgram>
        <program>/etc/init.d/mysql</program>
        <programArguments>start</programArguments>
    </runProgram>
    <waitForPort>
        <progressText>Waiting for MySQL to Start.</progressText>
        <port>3306</port>
        <state>in_use</state>
        <timeout>30000</timeout>
    </waitForPort>
    ...
</project>

You can specify the port state (in_use/free) and the timeout (in milliseconds). This action check the port and finishes when the port is free or in_use or after the timeout set.

link

answered 14 Sep '11, 04:58

Jake's gravatar image

Jake ♦♦
826222226235
accept rate: 98%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×12
×6
×3
×2
×2

Asked: 14 Sep '11, 04:53

Seen: 997 times

Last updated: 14 Sep '11, 04:58