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. good going java samples
View Tutorial          By: Rajesh at 2010-08-17 03:36:12

2. Hi every one. I am working on my project in j2me a
View Tutorial          By: wazir at 2010-11-26 08:27:43

3. Sir, I need to use MS Access as a database in java
View Tutorial          By: John Moses at 2012-03-31 00:20:38

4. Write a program to input the number and use switch
View Tutorial          By: abdulaziz at 2014-03-28 16:22:35

5. Can u tell me more about struts related to databas
View Tutorial          By: archana at 2010-09-15 04:38:54

6. thankyou Mr Ramlak for your help but please can yo
View Tutorial          By: yash at 2008-05-12 16:46:18

7. Simple and straight to the point. Thank you.
View Tutorial          By: Barbara at 2008-03-21 10:02:47

8. Ku is quite correct. When you create any object, i
View Tutorial          By: Avnish at 2010-10-28 04:00:20

9. Can u please help me to implement traversing forw
View Tutorial          By: Rahi at 2015-09-18 11:12:32

10. Hi.....u have put an extra backslash in the last f
View Tutorial          By: Samantha at 2011-05-12 12:54:39