Mohamed Alharbi
Mohamed Alharbi

Reputation: 11

Socket in java and nmap

I have program write it in java it's wait a connection on port

when I scan the server by nmap the program is stop (erorr)

this is my code

SSLServerSocketFactory sslServerSocketfactory = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
                sslServerSocket = (SSLServerSocket)sslServerSocketfactory.createServerSocket(intSSLport);

out = new PrintWriter(sslSocket.getOutputStream(), true);
                  in = new BufferedReader(new InputStreamReader(sslSocket.getInputStream()));
                  String value = in.readLine();

thanks jtahlborn ,,,, I solved by using try and catch ,,, and make catch return to

sslSocket = (SSLSocket)sslServerSocket.accept()

again

Upvotes: 0

Views: 923

Answers (1)

dimba
dimba

Reputation: 27581

nmap is scanning open ports, by trying to connect to them (sending TCP SYN). Since you've opened server socket, it returns when there's a client connecting to it. In your case it's nmap, which tries to connect.

AFAIK, nmap won't complete TCP connection procedure (3 way handshake). nmap will receive TCP SYN/ACK sent as result of your call to accept(), and will conclude the port is open. That it's all, nmap won't send 3rd message required to complete TCP connection procedure (ACK).

Upvotes: 2

Related Questions