I need to monitor multiple ports of multiple servers using TCP syn. For example, send TCP syn to these ports every 60 seconds, to check those port open or closed.
I tried java socket.connect and nmap
try {
socket.connect(socketAddress, timeout);
socket.close();
System.out.println("port is open");
} catch (IOException e) {
System.out.println("port is closed");
}
The problems are java socket.connect is not TCP syn scan. Nmap can do it, but the project does not allow download other software. Do I want to know if there is any way to implement TCP syn scan using java code?