Remote control mAirList via TCP not working

Is the Automation on the Nonstop-PC already ON?

This is requisite for the command

If not, you can chain commands together like this:

NONSTOP AUTOMATION 1 ON; NONSTOP AUTOMATION 1 NEXT

The commands will then be executed sequencially.

Yes, the Automation mode is already running on the Nonstop machine.

(PS: Also a small correction on my previous post: On the studio PC I have a TCP Client running instead of a server. So the situation currently is:

  • Nonstop PC: ‘TCP Server’
  • Studio PC: ‘TCP Client’

Sorry for the inconvenience :wink: )

Which button is this? (sorry, I don’t own an Airence and couldn’t find the numbers in the manual)

Does it correctly execute the command if you use it for the local mAirlist it is directly attached to?

See config:remotecontrol:airence [mAirList Wiki] :wink:

1 Like

Thank you. I searched for a more precise listing. :wink:

I now found a numbered photo inside the Virtual Keyboard Mapper.

Is this Button 19 you referred to, @marcolg_arc ?

And

:slight_smile:

Yup, That’s Button 19 what i’m talking about. :grin:

When I assign a command (for example ‘AUTOMATION 1 NEXT’), it works on the instance on the Studio PC (same machine as where the Airence is connected).

I stumbled across this post:

I can’t test it by myself yet but maybe if you’re using the prefix in the command itself AND set it in the server settings this causes the problem?

The thread opener described the exact same situation like you:

Sorry for my delayed response. Today was quite busy so doesn’t had the time to dive further into it.

I tried the above steps from the other forum thread. But to verify (correct me if i’m wrong):

When I set the command prefix on the TCP Server (nonstop pc) to ‘NONSTOP’ and leave the command prefix on the client (studio pc) blank, it should problably work then.

What I understand is that the TCP Client send commands to the TCP Server (and not vice versa)?

Maybe @Torben as the genius behind the code can tell you more, I didn’t had the opportunity to test it for now :wink:

Did you try this yet?

The client forwards a request to the server (as it is supposed to) which contains the message to be sent, like

http://ip.of.the.server:80/this_is_the_message_to_be_sent

I think a lot of things are being mixed up here… In particular, I don’t think this has anything to do with HTTP, @Tondose.

Anways, to explain what these TCP remote controls do:

TCP Server

Opens a TCP (telnet) server and waits for strings being sent to it, terminated with CR. The first command must be

AUTH <password>

with <password> being the password you set in the config.

Once authenticated, all strings being sent will be injected as commands into the mAirList instance.

TCP Client

The same, but as a client. It connects to an existing TCP/telnet server and waits for commands being received.

If a password is configured, it will send AUTH <password> as the first line when the connection is established. This makes it compatible with the TCP Server remote.

After that, all lines it receives from the server are injected as commands. If a “prefix” is configured, only lines starting with that prefix are being processed (and the prefix is removed). For example, if the prefix is STUDIO1, the server must send STUDIO1 AUTOMATION 1 NEXT to execute AUTOMATION 1 NEXT. This way, you can build a simple TCP server to which many studios connect, and only process those commands meant for the particular studio.

If you don’t want to receive and process any commands, but only use the remote to send them (see below), you can turn on Dummy Mode, and nothing will be processed.

Now how do you send commands from a TCP Client to a TCP Server? With the help from a script:

begin
  TCPClientRemote(0).WriteLine('AUTOMATION 1 NEXT');
end.

Note: The 0 here refers to the first TCP Client remote registered in your configuration (the index is zero-based).

You can also turn this into a background script that sends all command starting with e.g. NONSTOP to the server via the remote:

procedure OnExecuteCommand(Command: string);
begin
  if copy(command, 1, 8) = 'NONSTOP ' then
    TCPClientRemote(0).WriteLine(copy(Command, 9, 255));
end;

Other ways to do it:

  1. Instead of using a TCP Client remote, you can send the raw data via TCPSendString:
TCPSendString('192.168.10.53', 9393, 'AUTH mysecretpassword' + #13 + 'AUTOMATION 1 NEXT' + #13);
  1. Use REST server and ExecuteRESTCommand instead (requires at least Advanced Server on both server and client side, because you need the REST module).

  2. If both computers are in the same LAN, use Network Sync instead which can send commands via UDP broadcasts (but requires Professional Studio on both ends).

3 Likes

Great explanation, thank you.

A little update from my side:

First of all, thank you @Torben for the helpful explanation. Apparently I was a bit confused of how a TCP Server and Client communicate with each other. But this helps me a lot further.

What i’ve tested so far:

  • I created a little manual script with the following code (same as in Torben’s post). But I changed WriteLn to WriteLine since this small typo gave me errors. :wink:
    So the code looks like this (see below) and this works perfectly!!
begin
  TCPClientRemote(0).WriteLine('AUTOMATION 1 NEXT');
end.
  • So i’ve decided to realise this with a background script.
    I also copied the code for the background script from Torben’s post. Also with the WriteLine correction. But then this gives me an error in the status bar.

This is the current code:

procedure OnExecuteCommand(Command: string);
begin
  if copy(command, 1, 8) = 'NONSTOP ' then
    TCPClientRemote(0).WriteLine(copy(Command, 9, 255));
end.

I have some experience with programming, but only in C#, Java en VB.
So this language is a bit new for me.
Does someone have any idea what could be wrong?

1 Like

As the procedure … always is a subroutine of the main programme, it should be concluded with an
end; (with semicolon). So it rather should look like

procedure OnExecuteCommand(Command: string);
begin
  if copy(command, 1, 8) = 'NONSTOP ' then
    TCPClientRemote(0).WriteLine(copy(Command, 9, 255));
end;

begin
end.

1 Like

Oh that’s right! I forgot about that completely (read about it earlier).
Changed the script and now it works as intended!!

Thank you all for the great support! My problem is solved.

And also nice to see that this forum is really active and helpful. I use mAirList for quite some months now but am quite new at this forum. My experience here is really good so my compliments. :clap:

2 Likes

Sorry for the typos - obviously I did not test any of these scripts before posting them, just typed them here :wink:

@Tondose: The empty “main program” in background scripts…

begin
end.

… is not executed anyway, so you can just omit those lines.

Good. There were times you couldn’t.

Just checked. That was 11.5 years ago. Your memory is better than mine.

Well, the last issue on this behalf we’ve had here was on May 15th.

There is a different between background scripts, and “one-shot” scripts (those that you run from an action, the menu, etc.).

The “begin/end.” block (with the period, at the end of the script), is the “main program” in a script. This is what is being executed when you run a “one-shot” script.

Background scripts don’t need a main program, because they are basically a collection of procedures that are executed individually by the mAirList script engine.

That being said, even the background scripts do require an (empty) main program in order to compile correctly (make them a valid script). But mAirList will add it for you automatically. So no need to type it manually.