Question

My idea here is create a website where the user is able to click a button which will look into the IP Addresses to see which one is using a certain port, for example:

I want to search for the IP Addresses which are communicating with the localhost that are using the port #3620 (which is obviously being used) and a code will show all the IP Addresses.

My question here is to see if this is possible and if it is, can someone give a brief idea of how this could be done?

Was it helpful?

Solution

For seeing if a port is open check out this: In C#, how to check if a TCP port is available?

You could even loop over all port numbers for an IP address and check to see what ones are open.

 TcpClient tcpClient = new TcpClient();
 try
 {
    tcpClient.Connect("127.0.0.1", 9081);
    Console.WriteLine("Port " + 9081+ " Open");
 }
 catch (Exception)
 {
    Console.WriteLine("Port " + 9081+ " Closed");
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top