Skip to content

Commit 0796377

Browse files
committed
Merge branch 'master' of github.com:stealthcopter/AndroidNetworkTools
2 parents d4d13eb + d997e35 commit 0796377

File tree

1 file changed

+4
-2
lines changed
  • library/src/main/java/com/stealthcopter/networktools/portscanning

1 file changed

+4
-2
lines changed

library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanTCP.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.IOException;
44
import java.net.InetAddress;
5+
import java.net.InetSocketAddress;
56
import java.net.Socket;
67

78
/**
@@ -12,8 +13,9 @@ public class PortScanTCP {
1213
public static boolean scanAddress(InetAddress ia, int portNo, int timeoutMillis){
1314
Socket s = null;
1415
try {
15-
s = new Socket(ia, portNo);
16-
s.setSoTimeout(timeoutMillis); // This is pointless as we don't get to this point? unless open???
16+
s = new Socket();
17+
s.connect(new InetSocketAddress(ia, portNo), timeoutMillis);
18+
1719
return true;
1820
} catch (IOException e) {
1921
// Don't log anything as we are expecting a lot of these from closed ports.

0 commit comments

Comments
 (0)