My program reports that the port is already used.
How to find which program or process is listening on a certain port in Linux?
For example, to find which program is listing on port 9999
netstat -pln | grep 9999
You will need to use
sudo to get more details, such as process names that are now owned by you.
sudo netstat -pln | grep 9999
p makes netstat print process name, ‘l’ means “listening” and ‘n’ means numerical addresses instead of trying to determine symbolic host, port or user names.
If you are sure that the programming is using TCP or UDP, you can also add option
u to filter out only TCP and UDP connections like
sudo netstat -ptln | grep 9999 sudo netstat -puln | grep 9999
For more details, please check netstat manual.