• Post Reply Bookmark Topic Watch Topic
  • New Topic

SSLSocket accept problem  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm new to a socket programming and here's the problem I have:

public class Serveur {
public static void main(String[] args) throws IOException {

final int port = 4000;
SSLServerSocket serverSocket=null;

try {
SSLServerSocketFactory factory =(
SSLServerSocketFactory)
SSLServerSocketFactory.getDefault();
serverSocket = (SSLServerSocket)factory.createServerSocket(port);
} catch (IOException e) {
System.err.println("Could not listen on port: 4444.");
System.exit(1);
}

SSLSocket clientSocket = null;

try {
clientSocket = (SSLSocket) serverSocket.accept();
} catch (IOException e) {
System.err.println("Accept failed.");
System.exit(1);
}

cannot compile error: Accept failed.
 
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
compiles without error.
 
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This compiles ok under JDk1.5 Beta. Added the imports and two closing braces
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

cannot compile error: Accept failed.


Did you mean: cannot execute: Accept failed.?
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ARRRG,

I'd scream bloody murder at my developers. You are printing your own message and not what occurred. add the line e.printStackTrace(); and find out exactly what the Exception was. If you are using a JDK1.40 or jdk 1.41 then more than like it's an expired Certificate Root. You can upgrade to JDK 1.4.2 to correct if that is it!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!