• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Socket Programming Java with TLS

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm a Java / Security Beginner, can you please help me understand the difference between these 2 codes? I'm having a rough time understanding it.



AND



Thank you so much for your help!
 
Saloon Keeper
Posts: 7162
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

The codes don't seem to be doing remotely the same thing, do they? What do these codes signify? Meaning, what are you actually trying to understand?
 
Tess Sta
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! Actually, I'm trying to build a client-server socket communication with TLS using java and python. These lines, I think, will let me enable communication between the client and server.
 
Master Rancher
Posts: 180
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this topic related?
https://coderanch.com/t/739033/java/communication-java-client-python-server
 
Tess Sta
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. If anyone can help, please.
 
Matthew Bendford
Master Rancher
Posts: 180
5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although it's up to staff to judge - don't skip around between several accounts and topics while you try to ask for a solution to an issue - stick to the account and topic originally used to ask the initial question. Also, if you do crossposting on several sides - please, be so fair to at least include a note to each others site/thread for link up to enable others to easy check if the question has already been answered.

Anyway - as someone quite into all that crypto stuff: from as far as I understand the posted code and the question: There's no difference other than the former has a global impact to all getDefault() calls within the whole VM while the second one only cares about instances directly derived from the sslContext you set up.
Or, in other words: calling a setDefault() in the latter example would end up in the same result.

From wherever you got that from: It's mostly pointless as for a client you usually don't override any of the crypto stuff - and for a server you most often end up with your own SSLContext instance anyway.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic