How to listen for ssl and regular requests with the same (SSL)ServerSocket and distinguish between them!?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ilija_Jovanoski
Posted On:   Tuesday, June 4, 2002 07:09 AM

How can I listen for regular (say http) requests and secure(https) request on a same SSLServerSocket, and how can I recognize what type the request was after accept()?


Thank you for your time.

Re: How to listen for ssl and regular requests with the same (SSL)ServerSocket and distinguish between them!?

Posted By:   Bjornie_Wikstroem  
Posted On:   Tuesday, June 4, 2002 02:19 PM

The SSLSocket extends the Socket-class, so to figure out if it's a regular Socket you can do like this:


public void CheckSocket ( Socket socket ) {
    if ( socket instanceof javax.net.ssl.SSLSocket ) {
        System.out.println ( "The socket was an instance of SSLSocket" );
    }
    else {
        System.out.println ( "The socket was NOT an instance of SSLSocket - it's was a pure, regular Socket" );
    }
}

About | Sitemap | Contact