This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes SSLSocket accept problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "SSLSocket accept problem" Watch "SSLSocket accept problem" New topic

SSLSocket accept problem

emin ganba

Joined: May 18, 2004
Posts: 1
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 =(
serverSocket = (SSLServerSocket)factory.createServerSocket(port);
} catch (IOException e) {
System.err.println("Could not listen on port: 4444.");

SSLSocket clientSocket = null;

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

cannot compile error: Accept failed.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

compiles without error.
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
This compiles ok under JDk1.5 Beta. Added the imports and two closing braces

The nice thing about Standards is that there are so many to choose from!
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

cannot compile error: Accept failed.

Did you mean: cannot execute: Accept failed.?
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340

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 Hope This Helps
Carl Trusiak, SCJP2, SCWCD
I agree. Here's the link:
subject: SSLSocket accept problem
It's not a secret anymore!