lapots
lapots

Reputation: 13395

find what program is using port on remote computer

How to do it using JAVA? I can find what port is used or not used by iteration through all ports

tcp = new Socket(remote_address, i); // i [0 - 65535]
tcp.setReuseAddress(true);

But how to find what application is using this port?

Upvotes: 3

Views: 733

Answers (2)

Shuhail Kadavath
Shuhail Kadavath

Reputation: 448

Its really hard to find this using java . You have to write a quite large codes checking various characteristics of ports for this . If u google about this , you can get more details regarding this . Actually some requests has to be send to the port . Now various applications running behind that port will respond with particular headers/banners/format which you will be using to check against various pre set conditions . But this is not a 100% accurate way .

Smart Net Admins can fake you by putting up decoys behind the port .

Instead ,you can use Nmap for this . Its a command line tool used in linux/windows/mac that can help you find quite a lot information about port.

Upvotes: 2

nanofarad
nanofarad

Reputation: 41271

You can't really determine this. Any application can send any stream of data over TCP, and for security reasons, this information is not exposed remotely. You can, however, probe the port with different messages and see what happens, allowing you to experimentally infer the application.

In addition, some services/protocols will have distinctive greetings, headers, and messages, and can even expose debugging information.

Upvotes: 2

Related Questions