Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SSLServerSocket

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i would like to know
Difference between ServerSockets and SSLServerSockets....???
both act as same way when keystores are used....

Regards,
vidhya.
 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The difference is that a SSLServerSocket is operating over an SSL connection (ie, it is secure). But you can handle it the same way as you would a ServerSocekt.
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You use the SSL sockets just like normal sockets. You'll need to obtain a SSL certificate and store it in a Java keystore.

try
{
// I store the SSL certificate in PrivateKey.keystore
System.setProperty( "javax.net.ssl.keyStore", "PrivateKey.keystore");
System.setProperty( "javax.net.ssl.keyStorePassword", "password" );

SSLServerSocket server = (SSLServerSocket)
SSLServerSocketFactory.getDefault().createServerSocket( port_ );
while( true )
{
SSLSocket conn = (SSLSocket)server.accept();

Thread clientThread = new Thread(new ConnectionProcessor(conn));
clientThread.start();
}
}
catch( IOException ex )
{
...
}
 
I don't even know how to spell CIA. But this tiny ad does:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic