Comment on Tutorial - Simple Port Scanner application using Java By Syed M Hussain



Comment Added by : Asad

Comment Added at : 2014-02-13 05:55:26

Comment on Tutorial : Simple Port Scanner application using Java By Syed M Hussain
Try this

import java.net.*;

public class PortScanner

{

public static void main(String args[])
{
int startPortRange=0;
int stopPortRange=0;

startPortRange = Integer.parseInt(args[0]);
stopPortRange = Integer.parseInt(args[1]);



for(int i=startPortRange; i <=stopPortRange; i++)
{
try
{
Socket ServerSok = new Socket("127.0.0.1",i);

System.out.println("Port in use: " + i );

ServerSok.close();
}
catch (Exception e)
{
}
System.out.println("Port not in use: " + i );
}
}
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Excellent explanation. How can I take input from t
View Tutorial          By: Joe at 2013-03-31 11:02:28

2. can u please help me to read excel sheet in VB
View Tutorial          By: Mohd at 2009-07-05 05:03:11

3. This code works for me. But i have a doubt how to
View Tutorial          By: Daya at 2015-05-04 12:04:19

4. #include<iostream>
#include<conio.

View Tutorial          By: Zohaib Farooq at 2011-05-23 12:47:54

5. I have ran this code but each port has raised an &
View Tutorial          By: Jawnie at 2012-03-29 07:23:22

6. not good not bad...............
View Tutorial          By: mahesh at 2010-10-05 00:45:54

7. nice info on struts and very good explanation
View Tutorial          By: bharadwaj kvnss at 2013-02-07 17:18:44

8. Thank you, very useful example!
View Tutorial          By: Hui Chun Wai at 2013-03-24 15:07:53

9. My teacher doesnt teach me right!
View Tutorial          By: Anon at 2009-02-20 07:16:08

10. i wish to get some example java programs to unders
View Tutorial          By: rebecca at 2010-01-09 03:14:42