| | |
Finding Open Ports
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
there are thousands of ports, i think it ranges from 1-65,536 the first 1,024 are reserverd ports even though not all of them have been claimed yet, so program should generally try and refrain from usign them, i think you would have to go through every single port and check to see if it is occupied to do this
also check out:
http://www.iana.org/assignments/port-numbers
also check out:
http://www.iana.org/assignments/port-numbers
Try to open a ServerSocket on the port. If you can, the port was available and you immediately close the socket again.
If you cannot, you get an exception (or an errorcode, check the API docs for ServerSocket) and you know the port is in use already.
If you cannot, you get an exception (or an errorcode, check the API docs for ServerSocket) and you know the port is in use already.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
![]() |
Similar Threads
- How do you open ports. (Networking Hardware Configuration)
- Open ports on XP Home computer (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: tutorials
- Next Thread: Simple Command Line interface -
| Thread Tools | Search this Thread |
Tag cloud for Java
affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth businessintelligence chat class classes client code component csv database desktop draw ebook eclipse equation error event exception fractal game givemetehcodez graphics gui html ide image input integer intersect iphone j2me java java.xls javaexcel javaprojects jmf jni jpanel julia linked linux list loop mac main map method methods mobile netbeans newbie number online open-source oracle parameter print problem program programming project properties recursion reference replaysolutions reporting rotatetext scanner screen scrollbar server set size sms socket sort sql string superclass swing template test threads time tree windows working xstream






