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

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

Java program to check if user input is an even number

Archived Comments

1. simple and clear..
View Tutorial          By: sudhesh at 2011-12-22 04:05:14

2. Why use recursion in Java, even for Strings? The s
View Tutorial          By: Kristoffer L at 2012-11-21 01:51:36

3. I made this "In your AndroidManifest.xml file
View Tutorial          By: lalo at 2011-11-20 05:56:43

4. Hibernate can be an effective framework if one app
View Tutorial          By: Giao Vu at 2011-08-03 23:40:02

5. When I use this code it puts everything I append o
View Tutorial          By: Amber at 2012-06-18 15:33:22

6. I have compiled by keeping all the points in mind
View Tutorial          By: Sweety at 2011-03-09 22:29:18

7. Hi Steve,

thanks for your code. It

View Tutorial          By: Johnny at 2010-10-29 09:25:41

8. How to Use Code in my Page ? plz give me the sugee
View Tutorial          By: jaty at 2015-08-19 12:25:20

9. Great!! Many thanks!
View Tutorial          By: Louis at 2013-06-01 23:16:41

10. today Iam getting time ,date of sending and "
View Tutorial          By: raghu at 2012-01-07 14:43:32