No need to shell out... there's an API for that!
In reply to Re: port scanner using nmap by stevieb in thread port scanner using nmap by hegaa