In this section we cover and explain Looked for Local Port in details for freshers and experienced
| previous | Home | Next |
Looked For Local Port
If you want to know that Port address or Port Number , then using the program.
Example
import java.net.*;
import java.io.*;
public class lookedforlocalport {
public static void main(String[] args) {
ServerSocket server;
for (int i = 1024; i <= 65535; i++) {
try {
// the next line will fail and drop into the catch block if
// there is already a server running on port i
server = new ServerSocket(i);
server.close();
}
catch (IOException e) {
System.out.println("There is port from server " + i + ".");
} // end try
} // end for
}
}
| previous | Home | Next |