Reputation: 11
Hi I have written a server in Android. The following is my code:-
SSLServerSocket ss=(SSLServerSocket)sslssf.createServerSocket(Constants.CHAT_SERVER_PORT);
final String[] enabledCipherSuites = { "SSL_DH_anon_WITH_RC4_128_MD5" };
ss.setEnabledCipherSuites(enabledCipherSuites);
while(true) {
Socket s=ss.accept();
OutputStream out=s.getOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(out);
oos.flush();
Android android=new Android();
oos.writeObject(android);
InputStream sis= s.getInputStream();
ObjectInputStream ois=new ObjectInputStream(sis);
}
Everything is going fine. But "OutputStream out=s.getOutputStream();" in the above code is taking signifacant amount of time. Nearly one minute. I am not sure why? Please help me solving this problem?
The following is the corresponding client code(desktop):-
SSLSocket socket= (SSLSocket)sslsf.createSocket(ip,Constants.CHAT_SERVER_PORT);
final String[] enabledCipherSuites = { "SSL_DH_anon_WITH_RC4_128_MD5" };
socket.setEnabledCipherSuites(enabledCipherSuites);
InputStream in=socket.getInputStream();
OutputStream out=socket.getOutputStream();
ObjectInputStream ois=new ObjectInputStream(in);
ObjectOutputStream oos=new ObjectOutputStream(out);
Object obj=ois.readObject();
SocketInfo sockInfo=new SocketInfo(socket,oos,ois,ip);
Kindly help me in this issue.
Upvotes: 0
Views: 295
Reputation: 310883
That will be the SSL handshake taking the time. If Android supports javax.net.debug=ssl,handshake you can see into it to learn more.
But why are you using an anonymous cipher suite. Are you aware it's insecure?
Upvotes: 1