Hi @Kasthuri C M ,
Thank you for your reaching out and welcome to Microsoft Q&A!
You mentioned that:
I am getting socket hang-up error, the connection gets created if I set encrypt to false.
Encrypt=false
indicates the client does not require encryption, this is the cause of creating successfully. TLS will still use when possible, encrypting login credentials at a minimum. Below is the relevant excerpt from the encryption support.
I am getting socket hang-up error
Could you please post the detailed error messages here to help us narrow down the issue?
Thanks for your understanding. Your time and cooperation are much valued by us. We are looking forward to hearing from you to assist further.
Best regards,
Lucy Chen
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
https://docs.microsoft.com/en-us/answers/support/email-notifications