in reply to Correct usage of fork and pipe?

Instead of doing it yourself, you should consider using nmap.