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

Gianluigi bagonergi at gmail.com
Tue Dec 8 20:02:05 CET 2020


Il giorno mar 8 dic 2020 alle ore 19:20 T Lee Davidson <
t.lee.davidson at gmail.com> ha scritto:

> 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.
>

However you, from FMain, always have to tell the class to destroy itself
(MyTester = Null), why not use a your method like Public Sub _destroy()?

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201208/1445165b/attachment.htm>


More information about the User mailing list