Using AddHandler In Service App. System Crashing.

BTW @Kem Tekinay after I moved the RemoveHandler code example you gave me to the Send Complete event of the TCPSocket it’s been running fine now for almost an hour. :wink:

If you have a custom subclass of TCPSocket that you’re using you dont necessarily have a “deconstructor” (destructor).
You can add one (add method and name it Destructor).
You may NOT need to though.
But it doesn’t hurt to add one to make sure removehandler gets done

However, if you’re not sure about objects, constructors, destructors etc you might want to read up on these things
See http://developer.xojo.com/
There’s an “introduction to programming using xojo” and you can probably just read the sections about constructors & destructors, object scope & life time
Or you can go through http://developer.xojo.com/userguide/object-oriented-programming again for relevant sections
There’s one specifically about constructors and destructors

I truly appreciate all the help. I really do. Thanks again to all you guys that helped me today. :slight_smile:

Please also keep in mind that the dataavailable event handler you have written is triggered by the event loop in the framework. This trigger is based on “There is data in the buffer”. There is NO guarantee that ALL the data has been received, just that SOME has. So you may need to accommodate multiple dataavailable events being triggered to get the entire data packet.

Have a look at http://blog.xojo.com/2015/03/23/guest_post_serial_communications_with_xojo/