Service ServerSocket Help

I have a desktop app that uses a ServerSocket to listen on a port and a TCPSocket to communicate a message back once a connection is established.

I am trying to convert this into a windows system service. I have never tried to create a service before in RS so I really know nothing about the rules here. I have tried to add the ServerSocket and TCPSocket to global classes but I cannot access them from the service run method like I could before using the event handlers.

Any help would be appreciated. Thanks.

The easiest way to access the event handlers is to create your own ServerSocket subclass and then implement the event handlers there. In the Run event of the service app, you can instantiate your subclass and tell it to start listening. Do the same thing for TCPSocket.

Have a look at this template and adjust to suit.

Thanks I will take a look at both. I got it connecting sort of just now. Progress is being made.

Thanks Wayne for the example I nearly had it figured out but with one look at your example project I was able to see my one mistake. Working perfectly now!

Thanks for posting this Wayne, I only took a quick look around before coming across your recent post with this template.

The available documentation that I’ve come across appears to be very GUI app orientated and this is exactly what I’m looking for.

In my opinion something like the template you linked to above should be in the console app examples distributed with Xojo.