Start Message Listener |
Start listening for messages from other computers.
Syntax
Start Message Listener [ Select ; Result (error) ; File name ; Security ID ;
Port number ]
Options
Select entire contents | replaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field |
Result (error) | an error code |
File name | the name of the file that contains the script that must be triggered later |
Security ID | (optional) a security ID which the sender needs to add to sent messages |
Port number | (optional) use the specified portnumber, if you leave this empty the default port number of the Activator is used (UDP port 54242) |
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 4.5
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 security ID makes listening for messages safe. No one can trigger a script on your computer, unless they know the security ID. If the sender sends a different security ID no triggering occurs!
For the security ID 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 security ID all messages will be triggered, even if the sender has included a non-empty security ID.
Example
Start Message Listener [ Select ; gErrorCode ; Get ( FileName ) ; "12345" ]
This will start the listening for messages. Only messages which have security ID 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 security ID, for example “secretpassword”. Add the following script step:
Start Message Listener [ Select ; gErrorCode ; Get ( FileName ) ; gSecurityID ; Port number: 50505 ]
This will start the listening for messages on port 50505. Only messages which are sent to this port and have security ID that’s equal to the value in field gSecurityID are handled, others are ignored.
Used in example file
RemoteTriggers.fmp12
Related script steps
Send Remote Script Trigger |
Stop Message Listener |
Related functions
Actr_GetIPAddress |
Actr_StartListener |
Related topics
Activator Plug-in online help (overview)