Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.net.SocketException: Socket is not connected

843811Mar 1 2005 — edited Mar 2 2005
I have written a simple SSL client using JSSE. I am
using the following calls to connect to the server:
TrustManager[] tm = new TrustManager[]{new ClntSSLTrustManager()}; //This class just trusts all certs
sslContext = SSLContext.getInstance("TLSv1");
sslContext.init(null, tm, null);
SSLSocketFactory factory = sslContext.getSocketFactory(); 

/*ssl_sock = (SSLSocket)factory.createSocket(host, port);*/
ssl_sock = (SSLSocket) factory.createSocket();
InetSocketAddress add = new InetSocketAddress(host,port);
ssl_sock.connect(add, 1000);
ssl_sock.startHandshake(); If I run my client with this, then I get the following exception at the line in Bold: java.net.SocketException: Socket is not connected at java.net.Socket.getOutputStream(Socket.java:763) at com.ibm.sslite.be.a(Unknown Source) at com.ibm.sslite.m.a(Unknown Source) at com.ibm.sslite.n.(Unknown Source) at com.ibm.sslite.be.a(Unknown Source) at com.ibm.sslite.be.(Unknown Source) at com.ibm.jsse.bs.a(Unknown Source) at com.ibm.jsse.bs.startHandshake(Unknown Source) at SimpleSSLClient.main(SimpleSSLClient.java:192) I get this error with IBM JSDK 1.4.2 on an IBM-AIX machine. I don't get this problem with Sun JSDK1.4.2. Also, I don't get this with IBM JSDK 1.4.2 on an Win2K machine. In addition, if I use the commented lines in Italics above, instead of Socket.connect() call, I don't face any problem. Can anybody please help me out in this? Can this be a IBM JDK problem? Thanks Sujit
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 30 2005
Added on Mar 1 2005
1 comment
4,040 views