We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1e31aa1 + 145d97b commit d997e35Copy full SHA for d997e35
library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanTCP.java
@@ -2,6 +2,7 @@
2
3
import java.io.IOException;
4
import java.net.InetAddress;
5
+import java.net.InetSocketAddress;
6
import java.net.Socket;
7
8
/**
@@ -12,8 +13,9 @@ public class PortScanTCP {
12
13
public static boolean scanAddress(InetAddress ia, int portNo, int timeoutMillis){
14
Socket s = null;
15
try {
- s = new Socket(ia, portNo);
16
- s.setSoTimeout(timeoutMillis); // This is pointless as we don't get to this point? unless open???
+ s = new Socket();
17
+ s.connect(new InetSocketAddress(ia, portNo), timeoutMillis);
18
+
19
return true;
20
} catch (IOException e) {
21
// Don't log anything as we are expecting a lot of these from closed ports.
0 commit comments