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. it is nice but please give simple example like are
View Tutorial          By: red at 2009-12-03 23:07:37

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

3. the language of your information is easu and more
View Tutorial          By: shivprakashmeena at 2010-08-06 22:18:09

4. Post your errors, so that others may help you my f
View Tutorial          By: yogesh at 2010-01-12 00:45:42

5. Simple and to the point. Thanks for this tutorial.
View Tutorial          By: Balvinder at 2008-08-03 04:40:05

6. Zabardast
View Tutorial          By: Rohan at 2011-11-03 08:25:59

7. Its a good intro about J2ME..Thanks
View Tutorial          By: Deiveegaraja Andaver at 2012-02-10 06:53:29

8. This example is very clear. I cleared my concept o
View Tutorial          By: sukanta at 2009-10-20 06:08:50

9. There is another similar discussion on use of tern
View Tutorial          By: Syed Mamun Raihan at 2008-09-10 11:29:42

10. Working !

Nice example, thanks !

View Tutorial          By: Akh at 2015-01-14 14:22:24