检查ANT中端口是否打开

7

使用ANT任务可以检查端口是否打开吗?

我需要执行flexunit任务,但在开始此任务之前,我需要检查另一个flexunit任务是否正在运行并阻塞所需的端口。

谢谢任何建议,

Rafal

1个回答

10

使用ant socket条件。

<target name="check-port" description="Check whether Tomcat is running">
    <echo message="Checking whether Tomcat is running"/>
    <condition property="tomcat.running">
      <socket server="${tomcat.host}" port="${tomcat.port}"/> 
    </condition>
</target>

http://ant.apache.org/manual/Tasks/conditions.html


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接