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



Comment Added by : mobinga

Comment Added at : 2011-07-25 15:08:27

Comment on Tutorial : Simple Port Scanner application using Java By Syed M Hussain
Your code is syntactically correct, but semantically wrong.
You have to put the output statement within the catch blocks!

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" + i + "Not in Use");}

}


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. can u explain about printStackTrace()method.what i
View Tutorial          By: himabindu at 2009-06-10 20:03:14

2. what is the output
View Tutorial          By: Raja at 2012-12-28 11:47:48

3. hi,

i'm a jmeter user.in my test i

View Tutorial          By: mahesh at 2015-03-06 16:58:05

4. Good
View Tutorial          By: Siva Sreekanth at 2013-10-01 16:29:55

5. Really superb.Simple code.Thanks.
View Tutorial          By: pradesh at 2010-04-30 01:09:57

6. i am confused with importing a package.is it equiv
View Tutorial          By: amit at 2011-07-04 04:16:04

7. Great sample. Happy I found this site.
View Tutorial          By: javaslave at 2008-08-03 04:43:20

8. can we use this code in a web application. your he
View Tutorial          By: phani at 2008-09-17 06:15:26

9. Thanks...it was very helpful :)
View Tutorial          By: Swathi at 2012-01-25 06:49:46

10. Hallo.

And if the certificate is se

View Tutorial          By: Mario at 2009-11-11 08:42:46