Results 1 to 1 of 1
Thread: Looking for servers on ports
-
Looking for servers on ports
If you want to scan the ports on your machine and know on which ports servers are listening, use the code sample below. Alter the for loop according to the requirement.
Java Code:for (int i = 0; i < 2000; i++) { try { System.out.println("Looking for "+ i); theSocket = new Socket(host, i); System.out.println("There is a server on port " + i); } catch (UnknownHostException e) { System.err.println(e); break; } catch (IOException e) { // must not be a server on this port } }
Similar Threads
-
How to scan your computer for ports in use
By Java Tip in forum java.netReplies: 0Last Post: 04-07-2008, 08:13 PM -
Servers supporting EJBeans
By ravian in forum Enterprise JavaBeans (EJB)Replies: 3Last Post: 01-03-2008, 10:44 AM -
How to know the ports opened by JVM
By sandeepspatil in forum Advanced JavaReplies: 1Last Post: 08-02-2007, 01:51 PM -
Configuring Enterprise Application Servers In NetBeans IDE
By JavaForums in forum NetBeansReplies: 0Last Post: 07-30-2007, 11:13 PM -
Ports In Java
By Peter in forum Advanced JavaReplies: 2Last Post: 07-02-2007, 06:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks