| Author |
What's problem with this SSL Socket??
|
Javan Li
Ranch Hand
Joined: Jul 24, 2002
Posts: 84
|
|
Code: import java.io.*; import java.net.*; import javax.net.ssl.*; // // Example of an HTTPS server to illustrate SSL certificate and socket public class HTTPSServerExample { public static void main(String[] args) throws IOException { // // create an SSL socket using the factory and pick port 8080 SSLServerSocketFactory ssl= (SSLServerSocketFactory)SSLServerSocketFactory.getDefault(); ServerSocket ss = ssl.createServerSocket(8081); // // loop forever while (true) { try { // // block waiting for client connection Socket s = ss.accept(); System.out.println( "Client connection made" ); // get client request BufferedReader in = new BufferedReader( new InputStreamReader(s.getInputStream())); System.out.println(in.readLine()); // // make an HTML response PrintWriter out = new PrintWriter( s.getOutputStream() ); out.println("<HTML><HEAD><TITLE>HTTPS Server Example</TITLE>" + "</HEAD><BODY><H1>Hello World!</H1></BODY></HTML>\n"); // // Close the stream and socket out.close(); s.close(); } catch (Exception e) { e.printStackTrace(); } } } } When i run it , it throw : java.net.SocketException: no SSL Server Sockets at javax.net.ssl.DefaultSSLServerSocketFactory.createServerSocket(DashoA6275) at learningjce.HTTPSServerExample.main(HTTPSServerExample.java:25) Exception in thread "main" what's problem???thx!!!
|
 |
Peter den Haan
author
Ranch Hand
Joined: Apr 20, 2000
Posts: 3252
|
|
Are you using J2SE 1.3, and if so, have you followed the JSSE installation instructions to the letter? - Peter
|
 |
 |
|
|
subject: What's problem with this SSL Socket??
|
|
|