Log In    |    Knowledge Base    |    4D Home
Tech Tip: Interprocess Variables in Contextual Mode Web Serving
Published On: December 1, 2000

When web serving in contextual mode, the developer needs to be careful with the use of interprocess variables (IP vars). If web serving from standalone 4th Dimension then IP variables will behave as expected (shared among all processes running). However, under 4D Server IP variables behave differently when code is run under 4D Client than it will if run from a Contextual Web Process. Since all processes are running on the server, the use of interprocess variables may cause some unexpected results. For example, if you used IP variables to keep track of the date & time a person logged into 4D Server in each users startup method:

<>loginDate:=Current Date
<>loginTime:=Current Time

This would work fine under 4D Client because each client has its own set of IP variables. However, if we put the same code into our On Web Connection method it won't work properly because all web processes run on the 4D Server machine, share the same IP var memory space, and therefore would overwrite each others IP vars. The last process to connect would always reset these values. An easy fix in this case is to use process variables instead.

This distinction is especially important to keep in mind when designing methods that can run under either 4D Client or a web context.