检查端口是否在ANT中打开

raf*_*lry 7 sockets ant port flexunit flexunit4

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

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

谢谢你的任何建议,

拉法尔

kjp*_*kjp 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>
Run Code Online (Sandbox Code Playgroud)

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