If I understand you correctly, you'd have to use raw sockets.
My advice would be, don't, for a couple reasons.
- A "Port Scanner" isn't exactly the kind of program that will make the birds sing and the world a greener place. Spyware sucks. Please don't do it.
- You won't be able to run this awful contraption without root.
- Using bits and pieces of protocols without using the whole thing doesn't sound particularly reliable anyway.
Plus, my understanding of the TCP/IP protocol at this level might be incorrect. Maybye you can't
use ports at all if all you've got is syn and ack.
p.s. It's spelled "please". You obviously know how to spell it, and I'm pretty sure you've got at least the minimum 104 keys required.