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. sir i m getting chat server started bt how a clien
View Tutorial          By: ashu at 2010-11-02 08:13:00

2. thnks lot 4 helping me
View Tutorial          By: sandeep dudi at 2011-11-17 06:06:03

3. can any body help to get the code for receiving SM
View Tutorial          By: ash at 2008-05-15 01:07:19

4. hey i can write more simple example of this pointe
View Tutorial          By: shruti at 2010-03-03 09:44:58

5. It is the same as #include
View Tutorial          By: Ballu at 2011-07-04 06:42:55

6. Really very nice and step by step explanation hel
View Tutorial          By: sabarish at 2011-11-08 06:47:49

7. thanks for providing information in a simple langu
View Tutorial          By: shailaja at 2010-09-01 03:50:41

8. For me it is executing without error, But not send
View Tutorial          By: Vijay at 2011-02-19 01:51:08

9. Dude I want to send sms using GSM Mobile connected
View Tutorial          By: Funmarkaz at 2009-08-23 02:59:50

10. Wow, Problem resolved ....
View Tutorial          By: Muhammad Farrukh at 2011-08-29 21:02:09