(re-) design question

Hullo all. I hope the collective intelligence of the community can help guide us here.

We have a large-ish program written & running under AcuGT (Extend) for Windows. It has a Windows UI. It is a real-time transaction processing engine with a UI to monitor and control the activity. So it runs in 2+ threads but its a single program.

We want to split this into two programs:

  1. A transaction processing engine that runs as a Windows Service, so it launches on boot and is always running. No UI at all.
  2. A UI that interacts with the above program. Ideally we would just take the existing code - the current UI thread - and make minimal changes to it, so it will still be an AcuGT/Extend program. But users could launch/run it using AcuToWeb.

We want to put minimal effort into this, as it does not extend the functionality of our product, it just solves some security + remote-access issues.

It should not be too hard to simply split this one program (currently implemented as two threads) into two programs. But what would be the easiest (and most robust) way to implement (inter-process) communications between them? They will be running on a single server.

Note there could be multiple instances of the UI app. We will have to figure that out. We can utilize a design that allows only one at a time.

Thank you!

Parents
  • 0

    So, you need to replace send/receive thread messages with something else.  C$SOCKET is your best solution, just make sure waiting for a connection doesn't block, nor does trying to read messages from a connection.   Just reserve a port on the local machine and use either localport or 172.0.0.1 as the IP address.  With C$SOCKET you could also move the client to a different machine.   Alternatively, for a local solution, you could also use send/receive files in a shared folder.  Client writes to file x, and then creates a matching "done" file.  Service watches for incoming message files using C$LIST-DIRECTORY, reads the file when it sees the .done.  Processes, removes the original file, creates a response file, also with a .done file.  Client has to watch the folder too.  Use C$SLEEP liberally to avoid busy loops.

  • 0 in reply to 

    For using C$SOCKET, I would probably set up a copy library with a thread command replacment routines: TCPSEND, TCPRECEIVE, TCPWAIT.  In the client program, set up whatever variables those routines would need to pass down to a subprogram (buffer, size, timeout), then PERFORM them, and use whatever response variables get set.  Those library routines should use the same subprogram for the C$SOCKET calls, so they can share the handle of an open socket.  Just pass down a variable indicating which operation is being requested.  (send can auto-connect, and receive/wait can use the server routine to wait for a connection if there isn't one yet)

Reply
  • 0 in reply to 

    For using C$SOCKET, I would probably set up a copy library with a thread command replacment routines: TCPSEND, TCPRECEIVE, TCPWAIT.  In the client program, set up whatever variables those routines would need to pass down to a subprogram (buffer, size, timeout), then PERFORM them, and use whatever response variables get set.  Those library routines should use the same subprogram for the C$SOCKET calls, so they can share the handle of an open socket.  Just pass down a variable indicating which operation is being requested.  (send can auto-connect, and receive/wait can use the server routine to wait for a connection if there isn't one yet)

Children
No Data