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

Gianluigi bagonergi at gmail.com
Tue Dec 8 16:09:52 CET 2020


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

> On 12/7/20 7:07 PM, Benoît Minisini wrote:
> > Le 08/12/2020 à 00:21, T Lee Davidson a écrit :
> >> I have a project using a class that implements a ServerSocket.
> >
> > It's the contrary. As Listen() references the SocketServer object, you
> must call the Close() method so that it can be freed
> > later. You should never have to implement the _free() method.
>
> So then, are you saying that I should implement a Close() method in the
> Tester class instead of relying on _free()?
> Public Sub Close()
>    MyServerSocket.Close
> End
>
> That doesn't make object sense to me because the internal workings of the
> Tester object should be privately encapsulated. (And,
> there is no Open() method.) But, if that is what will work, then that's
> what I'll do.
>

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?

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


More information about the User mailing list