How can i write port scanner in UDP fashion?

I know how to write a port scanner over TCP - i should connect() to each port.
How to do it in connectionless fashion?

I tried to do sendto(), but i discovered all messages are sent normally and i receive no. of bytes sent. So its not a proper way to test whether port is open or not since sendto() always succeed....

Any idea?

am doing it for practicing...
You will have to use ICMP Echo Requests and look for replies with the error "Destination port not found".
Topic archived. No new replies allowed.