TakeCalls |
Advanced | |
Aptilis 1 |
TakeCalls(Enabler[, port])
TakeCalls with it's first parameter set a non-zero value
puts your aptilis program in listening mode. In this mode,
other aptilis programs can use all the subs in your program
thru the predefined sub 'Call()'. The programs calling yours
may be on the same machine or on different ones across your
network or across the Internet if you're connected to it.
From the moment it gets to 'TakeCalls() Your program
can do nothing but reply to incoming calls. You can stop
taking calls by invoking takeCalls() with a parameter of
0. But this can only be done in a sub, and in taking call
mode, subs can only be run if they're called by a remote
program. (Or called by a sub that has been called by a remote
program, and so on).
In other words, only a call by different program may stop
your program from taking calls.
The second optional parameter is the port you want your
aptilis program to listen to. Usually this is set to 1108
by default, so you don't have to worry about it, but should you
wish to change the default, it's possible. You may want to do so
if you need several 'Listening' programs. Indeed, there can be
only one program listening on any given port.
Return value:
0 or -1 in case of error,
in which case the _errno variable will contain more details.
Check Call for an example and the
the Remote Sub Invocation topic
for more details.