title: How to implement secure socket communication in c++ application using winsock?
body: <p>I am trying to implement secure communication between a server and client in c++.  The limitation is that both the client and server must run on windows and have to be in c++. This is for a research project I am working on at my university.</p>
  
  <p>So far I have found that SChannel is the best option, but the documentation is extremely confusing and I can not find any guides/tutorials on how to use it. I have already looked at this link <a href="https://docs.microsoft.com/en-us/windows/desktop/secauthn/creating-a-secure-connection-using-schannel" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/windows/desktop/secauthn/creating-a-secure-connection-using-schannel</a> but still do not understand how to get it working. Could someone guide me through this if this is the best way?</p>
  
  <p>I also looked into use SSLStream using the CLR to have .net run inside of a c++ application. However I can not use this because the client application is threaded and threads can't be used with CLR.</p>
  
  <p>I already have a dummy client and server set up with communication between the two, I am just trying to secure and encrypt that communication.</p>
  
  <p>Any help is greatly appreciated!</p>