MFP programming language supports parallel programming by using call ... endcall block. The basic routine is :
1.Call function generate_interface in both client and server sides to create communication interface;
2.Call function initialize_local in server side to listen to any incoming connection requests;
3.Call function connect in client side to connect to server. This function returns a connection object;
4.Client sends a call ... endcall block, with related codes, resource files and copy of whole stack, to server. In the call statement, the first parameter is the connection object returned by connect function;
5.Client may send more call ... endcall blocks to server if needed;
6.When server receives a call ... endcall block, it will create an independent sandbox for this block. The sandbox has a complete set of server side MFP system libraries. However, its user defined libraries and resource files are seperated from server's MFP system or any other sandbox. Source files of user defined libraries are stored in the user lib folder of the MFP sandbox. Resource files are saved in the user resource folder of the MFP sandbox. In the server side, multiple sandboxes are running simultaneously. The sandboxes and server side MFP main thread do not affect each other.
7.After server finishes running a call ... endcall block, result will be returned by the block's return statement. The result value will be assigned to the client side variable which is the only parameter of the endcall statement. If endcall does not have any parameter, the result will be ignored. On the other hand, if a call ... endcall block's return statement doesn't return any value, while the corresponding endcall does have a parameter, the parameter's value in the client side will never change;
8.In client side, if code attempts to read the endcall statement's parameter value, while server hasn't returned result, the code will be blocked until result is returned;
9.If client wants to close connection, it needs to call functions close_connection and close_local. If server calls function close_local, the active listener is shutdown so that no incoming connection request will be accepted.
Developers may read the following docs for detailed information :