I have written a TCP server using the Socket class\'s asynchronous/IOCP methods, BeginSend()/BeginRead()/etc. I would like to add SSL capability using SslStream, but from the i
Wrap your Socket in a NetworkStream to use it with an SslStream
.
Socket socket;
...
using (var networkStream = new NetworkStream(socket, true))
using (var sslStream = new SslStream(networkStream, ...))
{
// use sslStream.BeginRead/BeginWrite here
}
Streams expose BeginRead/BeginWrite methods as well, so you don't loose this aspect.