by Pieter Philippaerts [Pieter at mentalis dot org] posted on 2004/05/13 |
|
The common base class that your software can abstract to is System.Stream. Both NetworkStream and SecureNetworkStream inherit this class.
We didn't inherit from TcpClient because most methods of this class are non-virtual, which basically means that if you do something like this:
TcpClient tc = new SecureTcpClient(...);
Stream s = tc.GetStream();
the 's' variable will contain a NetworkStream instead of the expected SecureNetworkStream.
Also note that the SecureSocket can handle both secure and non-secure connections. If you create a SecureSocket with the SecureProtocol set to SecureProtocol.None, the SecureSocket object is equivalent to a normal Socket object. |