Skip to main content

Actr_StartListener (function reference)

By January 1, 2024January 25th, 2024Online Help, Troi Activator Plug-in
Activator Plug-in > Functions reference > Actr_StartListener
Activator Plug-in for FileMaker Pro

Actr_StartListener

Start listening for messages from other computers.

SyntaxFunction badge

Actr_StartListener ( switches ; currentFileName ; securityID )

Parameters

switches determine the behavior of this command
currentFileName the name of the file that contains the script that must be triggered later
securityID (optional) a security ID which the sender needs to add to sent messages

Switches

switches must contain only one of this:

-Defaultportnumber use the default port number of the Activator (UDP port 54242)
-Portnumber=xxx use the specified portnumber xxx

Returned Result

Data type returned

Error code

Result

If successful it returns 0.
If unsuccessful it returns an error code starting with $$ and the error code. Returned error codes can be:

0 no error
$$-50 paramErr there was an error with the parameters
$$-4227 already listening
$$-4228 portnumber out of range: use 0 to 65535

Originated in

Activator Plug-in 1.2

Compatibility

FileMaker Pro 17 to 2023

Considerations

Which port you should choose is dependent on your network situation: you should use a port number that is not in use. Try to use the default port number. If this port is occupied choose a number in the private range: 49152 – 65535.

Below you find how ports are currently assigned:
0 – 1023: Well Known Ports, used by standard protocols. Don’t use for Activator.
1024 – 4915: Registered Ports. Not recommended for Activator.
49152 – 65535: Dynamic and/or Private Ports.

The securityID makes listening for messages safe. No one can trigger a script on your computer, unless they know the securityID. If the sender sends a different securityID no triggering occurs!
For the securityID you can for example use (random) numbers or a password, and you can distribute it in a field of a shared database. See the example file “Remote.fmp12”. If you specify an empty securityID all messages will be triggered, even if the sender has included a non-empty securityID.

Example

Set Field [ gErrorCode ; Actr_StartListener ( "-Defaultportnumber" ; Get ( FileName ) ; "12345" ) ]

This will start the listening for messages. Only messages which have securityID 12345 are handled, others will be ignored.

Example 2

We assume that in your FileMaker file the following fields are defined:

gSecurityID	Global, text 
gErrorCode	Global, text

gSecurityID should contain the securityID, for example “secretpassword”. Add the following script step:

Set Field [ gErrorCode ; Actr_StartListener ( "-Portnumber=50505" ; Get ( FileName ) ; gSecurityID ) ]

This will start the listening for messages on port 50505. Only messages which are sent to this port and have securityID that’s equal to the value in field gSecurityID are handled, others are ignored.

Used in example file

RemoteTriggers.fmp12

Related functionsFunction badge

Actr_GetIPAddress
Actr_SendRemoteEvent
Actr_StopListener

Related script stepScript step badge

Start Message Listener

Related topics

Activator Plug-in online help (overview)


Online Help Page for Activator Plug-in for 17 to 2023 –> Actr_StartListener (actrp4618) 2024-0125 14:56:44