Actr_StartListener (function reference)

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

switchesdetermine the behavior of this command
currentFileNamethe 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:

-Defaultportnumberuse the default port number of the Activator (UDP port 54242)
-Portnumber=xxxuse 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:

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

Originated in

Activator Plug-in 1.2

Compatibility

FileMaker Pro 12 to 16

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.

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 12 to 16 –> Actr_StartListener (actrp4618) 2017-0831 20:24:01