• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SSLSocket accept problem

 
emin ganba
Greenhorn
Posts: 1
  • 0
  • 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.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
compiles without error.
 
Eddie Vanda
Ranch Hand
Posts: 281
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cannot compile error: Accept failed.

Did you mean: cannot execute: Accept failed.?
 
Carl Trusiak
Sheriff
Posts: 3340
  • 0
  • 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!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic