Advertisement
Guest User

check port 22

a guest
Mar 16th, 2016
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. for (int i = 1; i < 32; i++) {
  2. string ip = "192.168.0."~to!string(i);
  3. Socket s = new Socket(AddressFamily.INET, std.socket.SocketType.STREAM, ProtocolType.TCP);
  4. InternetAddress ia = new InternetAddress(ip, 22);
  5. try {
  6. s.connect(ia);
  7.  
  8. writeln("\n\nDONE:", ip, ":22");
  9. } catch (Exception e) {
  10. writeln("\n\nFAIL:", ip, ":22 is unreachable :", e.toString(), "\n");
  11. }
  12. s.close();
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement