by Pieter Philippaerts [Pieter at mentalis dot org] posted on 2004/05/21 |
|
We didn't inherit from the Socket class to avoid virtual/non-virtual issues. The methods defined on Socket are all declared as non-virtual, which means that if you would do something like this:
Socket s = new MySocket();
s.Connect();
the runtime calls the Connect method of the Socket class instead of the Connect method of the MySocket class.
To avoid these issues, we decided to not inherit from Socket but provide a drop-in replacement instead. Simply changing your Socket s = new Socket(); calls to SecureSocket s = new SecureSocket(); will work. If you then decide to add SSL/TLS support to your application, you can use the appropriate methods or constructors to establish a secure session. |