This is one possibility. But you don't what to wait even 40 seconds if port is already busy.
I'd suggest enhance check_pid_and_port() function to exit right away with an appropriate error message if it finds the port busy.
This is one possibility. But you don't what to wait even 40 seconds if port is already busy.
I'd suggest enhance check_pid_ and_port( ) function to exit right away with an appropriate error message if it finds the port busy.