Check if port is open in ANT

Can I check if a port is open using ANT tasks?

I need to execute the flexunit task, but before starting this task, I need to check if another flexunit task is running and blocking the desired port.

Thanks for any suggestions,

Rafal

+6
source share
1 answer

Use the ant socket condition.

<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

+9
source

Source: https://habr.com/ru/post/891719/


All Articles