#!/bin/bash

# Check if root
# if [ "$EUID" -ne 0 ]; then
#       echo "Please run as root"
#       exit
# fi

response=$(nc -z -w 4 $1 $2; echo $?)
if [[ $response == 1 ]]; then
      # No response
      exit 1
else
      # Response
      echo 0
fi
