This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating SSLSockets