[Gambas-user] How to free an object with an active ServerSocket?

T Lee Davidson t.lee.davidson at gmail.com
Tue Dec 8 19:19:51 CET 2020

On 12/8/20 10:09 AM, Gianluigi wrote:
> Hi Lee,
> why do you think a Close method (but you could also call it Liber) breaks the encapsulation of the class, when the same 
> ServerSocket class also uses one?

Because the ServerSocket object is instantiated, and activated with Listen(), within my Tester class when a Tester object is 
created. So, the status of the ServerSocket is hidden from the Main form which uses it since the Main form does not need to know 
nor does it care. All of those details are encapsulated.

It just seems to me that I should also be able to Close() the ServerSocket when the Tester object is destroyed. And, I do not 
execute a Tester.Open(), I just create it with NEW. So, having to do a Tester.Close() just seems counter-intuitive.

A _beforefree special method would be nice. But, I'll just implement a Close, or Stop, or maybe even a BeforeFree method.


More information about the User mailing list