Hello,
I am developping an application that is connecting to a distant server via
SSL.
I have a watchdog monitoring network connection.
When the phone looses the network connection while my application is
running, I close the current socket and start a periodic task to try to
reconnect.
Problem starts when network is back : my application creates a brand new SSL
Socket, and start reading in it (socket.getInputStream().read()). Here, the
read action returns immediatly with result -1 (which I interpret as socket
input stream being not valid).
The periodic task runs infinitly, create a new SSL Socket, start reading in
it, and immediatly get -1 result...
The code for creating the socket :
SSLSocketFactory socketFactory;
socketFactory = SSLSocketFactory.getSocketFactory();
socketFactory.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
Socket socket;
try {
socket = socketFactory.createSocket();
HttpParams params = new BasicHttpParams();
socket = socketFactory.connectSocket(socket,
remoteIp.getHostName(), remotePort, null, 0, params);
} catch (Exception e) {
Log.e(TAG, "Unable to create socket", e);
}
For information, if I connect to the server using standard connection (I
mean, not SSL), everything is OK.
Do you think it can be a bug in org.apache.http.conn.ssl.SSLSocketFactory?
Any help would be appreciated!
Best Regards,
Lorie.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en