11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Caché</strong> <strong>ObjectScript</strong> Commandsserver ;SET io="|TCP|1"SET ^serverport=7001OPEN io:(:^serverport:"MA"):200IF $TEST=0 {WRITE !,"Cannot open server port"QUIT }ELSE { WRITE !,"Server port opened" }loopUSE io READ x ; Read for acceptUSE 0 WRITE !,"Accepted connection"JOB child:(:5:io:io) ;Concurrent server bit is onGOTO loopchild ;WRITE $JOB,! ;Send job id on TCP device to be read by clientQUITclient ;SET io="|TCP|2"SET host="127.0.0.1"OPEN io:(host:^serverport:"M"):200 ;Connect to serverIF $TEST=0 {WRITE !,"Cannot open connection"QUIT }ELSE { WRITE !,"Client connection opened" }USE io READ x#3:200 ;Reads from subjobELSE WRITE !,"No message from child" CLOSE io QUITUSE 0 WRITE !,"Child is on job ",XECUTECLOSE ioQUITThe child uses the inherited TCP connection to pass its job ID (in this case assumed to be 3characters) back to the client, after which the child process exits. The client opens up a connectionwith the server and reads the child's job ID on the open connection. In this example,the value "127.0.0.1" for the variable "host" indicates a loopback connection to the local hostmachine. You can set up a client on a different machine from the server if "host" is set to theserver's IP address or name.In principle, the child and client can conduct extended communication, and multiple clientscan be talking concurrently with their respective children of the server.Specifying Child Process Partition Size<strong>Caché</strong> supports specifying the partition size of the jobbed child process. By default, the jobbedprocess has a partition size equal to the system-wide default partition size in effect when youexecute JOB, regardless of the partition size of the parent process from which you issue JOB.The system-wide partition size increases dynamically to a maximum of 16mb.You can specify the partition size (in kilobytes) of the jobbed process in the second processparameter of the JOB command. The value you use must be a multiple of 32 and must rangefrom 128 through 16384.You can optionally specify the partition-size process parameter value in combination withother process information that you would normally put in the second process parameter ofJOB. Consider the following JOB command:72 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!