Secure Server : SSL Server Socket « Network Protocol « Java






Secure Server

   
import java.net.*;
import java.io.*;
import javax.net.*;
import java.security.*;
import javax.net.ssl.*;
import javax.crypto.*;

public class SecureServer {
  public static void main(String[] args) throws Exception {
         ServerSocketFactory ssf = SSLServerSocketFactory.getDefault();
         SSLServerSocket ss = (SSLServerSocket) ssf.createServerSocket(98999);
         Socket sock = ss.accept();
         ss.close();
         OutputStream rawOut = sock.getOutputStream();
         PrintWriter out = new PrintWriter(new OutputStreamWriter(rawOut));
         out.println(new java.util.Date().toString());
         out.flush();
         sock.close();

  }
}

   
    
  








Related examples in the same category

1.Creating an SSL Client Socket
2.Creating an SSL Server Socket
3.Secure Communication with JSSE
4.Secure Login based on SSL Server Socket
5.Simple Client for secure Socket
6.Simple server for Secure socket
7.SSL Server Demo
8.Secure Client
9.A simple single-threaded proxy server
10.implements HandshakeCompletedListener
11.Cipher Socket