hi all,
If you are running out of any of the unix/linux utility e.g. netstat or nc to detect the opening port, here is one of the simple trick that can help you to achieve your goal. have fun!
timeout 1 bash -c "cat < /dev/null > /dev/tcp/$SERVER/$port"
if [ "$?" -ne 0 ]
then
echo "Connection to $SERVER on $port is failed."
else
echo "Connection to $SERVER to $port is succeeded."
fi
No comments:
Post a Comment