[Gambas-user] Newbie question: socket example

Bruce Steers bsteers4 at gmail.com
Mon Feb 1 08:48:32 CET 2021


On Mon, 1 Feb 2021 at 07:21, Olivier Coquet <ocoquet at 3d-phenomen.fr> wrote:

> Hello petter,
>
> what do you mean by socket component?
>
> are you talking about gb.net ?
>
> Also, I don't understand this line:
>
>  MySock=NEW Socket AS "MySock"
>
> which should be:
>
>  MySock=NEW Socket
>
> Because, in the class header there is :
>
> PUBLIC MySock AS Socket
>

No Oliver the code is correct. your statement "which should be" is wrong
though,  you appear to be ill-advising.

To access the socket events like _Read the socket is named at creation with
'As "MySocket"'
then a function like...
Public Sub MySocket_Read() becomes available.
Or..
PUBLIC MySock As Socket  ' defines a socket object but does not create one
MySock = New Socket As "MyNewSocket"  '  creates the socket with a
reference name of MyNewSocket
with the above code MySocket_Read() event will not happen but
MyNewSocket_Read() will.
Do you understand?

BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210201/75747faa/attachment-0001.htm>


More information about the User mailing list