aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "SSLSocket accept problem" Watch "SSLSocket accept problem" New topic
Author

SSLSocket accept problem

emin ganba
Greenhorn

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 =(
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

Joined: Jun 02, 2003
Posts: 1923

compiles without error.


http://home.arcor.de/hirnstrom/bewerbung
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
Sheriff

Joined: Jun 13, 2000
Posts: 3340
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 Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
 
subject: SSLSocket accept problem
 
Similar Threads
Not getting the bytes sent
Data from server is not sent to client
sockets and printwriting
Socket : MultiClient Server
Abnormal server socket condition