UDPSocket in Class -> DataAvailable Call


I have a class ‘MyClass’ and would like to use a private UDPSocket object in in.
So in added a private property of type UDPSocket to my ‘MyClass’ and named it uSock. Addidionaly I added a method ‘newData’, which I would like to call with the Datagram. In MyClass->Constructor I added:

self.uSock = New UDPSocket

Now how can I get informed when packets available? I’ve I add it to the UI I can add a Handler with right click.

Have a look at AddHandler. With that you can map the UDPSocket Events to methods in your class.

Hi Wayne

Thanks. Helped a lot, so I knew that I’m on the right track. I missed always the part that I need to add ‘sender As UDPSocket’ to the parameter of the method I would like to call.

Hi Urs

I’ve been using Addhandler for so long I just add the parameter without thinking - sorry. Glad you got it sorted though.

Just as a matter of interest - what part of the world do you live in?