KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I made a very simple port scanner, but it runs too slow, so I'm looking for a way to make it scan faster. Here is my code: public boolean portIsOpen(String ip, int port, int timeout) { try { Socket socket = new Socket(); socket.connect(new InetSocketAddress(ip, port), timeout); socket.close(); return true; } catch (Exception ex) { return false; } } This code tests if a specific port is open on a specific IP address. For timeout I used a minimum value of 200 because when I go lower it doesn't have enough time to test the port. It works well, but it takes too much time to scan from 0 to 65535. Is there another way that could maybe scan from 0 to 65535 in less than 5 minutes?
Tags (comma-separated)
Save Edits
Cancel