aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Creating SSLSockets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Creating SSLSockets" Watch "Creating SSLSockets" New topic
Author

Creating SSLSockets

Sachin H. Gupta
Greenhorn

Joined: Oct 10, 2012
Posts: 17
Can I use the following code to create SSLSocket



Or I have to use the SSLSocketFactory ?



Is there any difference in socket if created by different methods. If yes, then which is the preferred way to create a SSLSocket.
Thanks
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067
    
  10

Sachin TrojanGupta wrote:Can I use the following code to create SSLSocket



No.

Or I have to use the SSLSocketFactory ?

Yes.



Is there any difference in socket if created by different methods. If yes, then which is the preferred way to create a SSLSocket.
Thanks


The question has no meaning since you cannot just caste a Socket to an SSLSocket. An SSLSocket isA Socket (i.e. it extends) but a Socket is not an SSLSocket.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Creating SSLSockets