remote udp port scanning

G

Gordon Beaton

Socket soc= new Scoket(address, portnumber);
look at the code above, it can only tell you active TCP ports for
the Throwable e tells you nothing about UDP ports. An active UDP
port doesn' respond to the connection call "soc". Therefore it will
throw an exception(connection refused) after trying to connect an
active UDP port.

This exception is just like those of closed TCP ports.

The Socket class is TCP only and has absolutely no relevance to UDP.
Similarly, TCP and UDP ports have nothing to do with each other.

If the Socket constructor throws an exception, it's because it failed
to connect to the specified TCP port. It says nothing about whether
the corresponding UDP port is active or not.

Instead you need to create and connect() a DatagramSocket, then
attempt to send() a datagram. Note that with UDP, connected only means
that the DatagramSocket is (locally) associated with a specific remote
address. Unlink TCP, no connection is actually established, so you
need to actually send a datagram to determine whether the remote is
active.

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top