Thank you for the feedback and suggestions!
Adding comments to explain key sections and functions is definitely a good idea to make the code more readable and understandable for others.
Regarding parallel scanning using multiple threads or processes, yes, it can definitely improve performance and speed up the scanning process. This can be achieved by dividing the range of ports into multiple smaller ranges and assigning each range to a separate thread or process to scan simultaneously.
However, it's important to keep in mind that parallel scanning can also put a heavier load on the network and the target system, and may cause network congestion or denial of service if not performed carefully and responsibly. So, it's always a good practice to take permission and follow security guidelines before performing any kind of port scanning.