Açıklaması şöyle
KullanımThis class is similar to the SSLSocket class. The main difference is that SSLServerSocket is used to create sockets at server side, while SSLSocket is used to create sockets at client side.
Örnek
Şöyle yaparız
String[] protocols = new String[]{"TLSv1.3"};String[] cipher_suites = new String[]{"TLS_AES_128_GCM_SHA256"};SSLServerSocket serverSocket = null;try {// Step : 1SSLServerSocketFactory factory =(SSLServerSocketFactory) SSLServerSocketFactory.getDefault();// Step : 2serverSocket = (SSLServerSocket) factory.createServerSocket(8980);// Step : 3serverSocket.setEnabledProtocols(protocols);serverSocket.setEnabledCipherSuites(cipher_suites);// Step : 4SSLSocket sslSocket = (SSLSocket) serverSocket.accept();// Step : 5InputStream inputStream = sslSocket.getInputStream();InputStreamReader inputStreamReader = new InputStreamReader(inputStream);BufferedReader bufferedReader = new BufferedReader(inputStreamReader);String request = null;while((request = bufferedReader.readLine()) != null) {...}} catch (Exception e) {...} finally {if (serverSocket != null) {serverSocket.close();}}
Hiç yorum yok:
Yorum Gönder