Communications with a client (RGA mass spectrometer) from PAC Control

Hi Phillip,

I wanted to use this strategy to open a socket with a client (RGA mass spectrometer).

I think it is a good starting point for communicating with the MS.

I imagine I would use the SendCommunicationHandleCommand to send the commands that the MS needs.

I guess I would need to change the size of the output table to accept whatever the MS is sending?

So essentially I want to use your example to listen on port 5026 for communications from the MS, and prompt it to send the MS experiment file.

Any tips would be appreciated :smile:

MASSoft Socket Interface.zip (121.7 KB)

I think you have summarized it well.
At this point, I’d just jump in and test it out keeping in mind the points you mentioned.
See how it goes (it could go very smoothly!) and if its a bit bumpy, A problem well stated is a problem half solved or so the saying goes… Drop back and let us all know either way.

Hi Beno,

Thanks for the reply.

I need to create two sockets on the same port (5026) for a single client. Does that mean I need two communication handles?

I am not able to connect the hardware to a controller yet, but I will be doing it soon and want to build some charts to test it using the TCP server example as a foundation.

I have an example of how to open the experiment file and start it running:

Create two sockets using the application program interface (API) with the client is being created.

Socket #1: -xStatus –d15
This requests the current status of the active MSIU. If this is available then we can
proceed.

Socket #1: -f” C:\Data\Hiden Analytical\MASsoft7\Templates\filename.exp”

Socket #2: -f” C:\Data\Hiden Analytical\MASsoft7\Templates\filename.exp”

Open the specified file on both sockets. Remember that only one instance of the file will be opened by MASsoft. MASsoft will only create an association between the socket and the experiment file.

Socket #2: -lStatus –v1

This creates a status hotlink in order to monitor the experiment file state changes. As we have successfully issued a link command this means that this is now a listening Socket only. We can no longer send any more commands to MASsoft via this socket.

Socket #1: -xGo –Odt

This command will start the experiment file running with the data being stored in an
experiment file consisting of the current time stored within a date subdirectory.

C:\Data\Hiden Analytical\MASsoft7\Templates<date subdirectory><time>.exp

Socket #1 will receive a “1” result string indicating it has successfully started running Socket #2 will also receive a string stating ScanningActive.

Note

If using MASsoft version v7.23 onwards there will be two status changes received. StartingActive followed by ScanningActive.

Monitor the socket #2 and when the experiment file has stopped running it will change status to StoppedShutdown. When this occurs the socket can be closed.

Socket #1: -xClose –d15
If successful the experiment file will close. When MASsoft closes an experiment file it will terminate ALL connections associated with it.

Destroy both sockets using the appropriate API of the language with which the client was created.

I also need to obtain “scan” data through the socket, so I need to run another command for that, “-lData”. There may be some additional commands required for data formatting. This command creates a “hot link” which prevents further commands from being sent, so we need the second socket again to report the status of the RC interface whenever it changes.

So I guess I am wondering what I need to do to open two “sockets” on the same port. If it is just multiple comm handles, how do I assign the comm handles to a socket?

This is both significantly different the original post thread/question and also significantly different from the post a few hours ago.
I think I might move this to its own thread…

Have you considered doing this in Node-RED?

This should be in its own thread - this isn’t a server on the Opto22 side, it is a normal client - the need to create two connections may not be necessary depending on the goals. all the -xGo and -xClose are just commands using plain text ascii out to the MASsoft computer that is listening on port 5026. You can open a second communication channel and send a command to listen for status events so you don’t need to poll for status. The document he attached is overly verbose making it look much more complicated than it is.