T4S4  18.1 C7177 A20283
Teamcenter Gateway for SAP S/4HANA API Reference
PIPE client/server handling

Functions

 tpco_closeAllECMD
 This function closes all pipe handles. More...
 
 tpco_closeECMD
 This function closes a pipe handle. More...
 
 tpco_getECMDState
 This function gets the status from a pipe handle. More...
 
 tpco_openECMD
 This function opens a pipe handle. More...
 
 tpco_receiveECMD
 This function receives a command and executes it. More...
 
 tpco_registerECMD
 This function registers a pipe command. More...
 
 tpco_sendECMD
 This function sends a command to a pipe-server and receives the result. More...
 
 tpco_sendECMD2
 This function sends a command to a pipe-server and receives the result. More...
 

Detailed Description

Function Documentation

◆ tpco_closeAllECMD()

tpco_closeAllECMD

This function closes all pipe handles.

If a pipe is closed, the pipe-server stops.

Returns
none

◆ tpco_closeECMD()

tpco_closeECMD

This function closes a pipe handle.

If the pipe is closed, the pipe-server stops.

Parameters
handle-idthe pipe handle
shutdownflag - if the shutdown flag is set then the exit command wait for running commands on the pipe-server. The shutdown flag blocks the pipe server for new commands !
exit-tout(optional default=10) after n-sec, the stop function kills the pipe-server PID
Returns
none
1 # close the pipe server handle: send pipe server exit -> wait 10 sec (default) -> stop of the pipe server hard (kill)
3 
4 # close the pipe server handle: send pipe server exit -> wait 180 sec -> stop of the pipe server hard (kill)
5 tpco_closeECMD $hd 180
6 
7 # close the pipe server handle: wait for finish of all pipe server commands (timeout=10sec) -> send pipe server exit and wait 10 sec -> stop of the pipe server hard (kill)
8 tpco_closeECMD $hd shutdown
9 
10 # close the pipe server handle: wait for finish of all pipe server commands (timeout=180sec) -> send pipe server exit and wait 180 sec -> stop of the pipe server hard (kill)
11 tpco_closeECMD $hd shutdown 180

Referenced by T4X::JAVASERVER::tpcontrol().

◆ tpco_getECMDState()

tpco_getECMDState

This function gets the status from a pipe handle.

Parameters
handle-idthe pipe handle
Returns
TCL-DIGT [DESC description CMD command_line SPID processID ITOUT idle-timeout]
1 puts [tpco_getECMDState $hd]
2 
3 output:
4 DESC {ecmdtest} CMD {/home/joerg/work/101CR2044/tp_core_Linux_x86_64_debug/bin64/tps var/init/start.tps /home/joerg/work/101CR2044/tp_core_Linux_x86_64_debug/var/ct/epipe/ecmdclient.tcl} SPID 16952 ITOUT 5

Referenced by T4X::JAVASERVER::isEPipeServerHandleValid().

◆ tpco_openECMD()

tpco_openECMD

This function opens a pipe handle.

Parameters
pipe-namethe name of the pipe (description)
pipe-serverthe pipe server with all process arguments
idle-timeout(optional) stop the pipe after n-seconds (default 0 - never stop the pipe)
Returns
>= 0 handle id, < 0 error

pipe client with tpco_openECMD (pipe server see tpco_receiveECMD example)

1 # pipe server command line
2 set pipe "[rcwd]/bin64/tps var/init/start.tps pipeserver.tcl"
3 
4 # open the pipe
5 set hd [tpco_openECMD ecmdtest $pipe]
6 if {$hd >= 0} {
7  # call pipecmd_sum and print the result
8  puts [tpco_sendECMD2 $hd 1 pipecmd_sum 100 200]
10  }
11 
12 output:
13 300

Referenced by T4X::JAVASERVER::activateFor().

◆ tpco_receiveECMD()

tpco_receiveECMD

This function receives a command and executes it.

Returns
0= OK 1= ERROR

pipe server with tpco_receiveECMD master loop.

1 # pipe service :: add two intergers
2 proc sum {s1 s2} {
3  return [expr $s1 + $s2]
4 }
5 
6 # register the pipe service sum as the pipe command pipecmd_sum
7 tpco_registerECMD pipecmd_sum sum
8 
9 # pipe master loop :: break on pipe protocol error
10 while (1) {
11  if {[tpco_receiveECMD] != 0} {break}
12  }

◆ tpco_registerECMD()

tpco_registerECMD

This function registers a pipe command.

Parameters
cmdnamethe pipe cmd-name
proctcl-function name
Returns
none

Register the pipe command pipecmd_sum and bind this to the tcl function sum.

1 tpco_registerECMD pipecmd_sum sum

◆ tpco_sendECMD()

tpco_sendECMD

This function sends a command to a pipe-server and receives the result.

Parameters
handle-idthe pipe handle
timeoutthe max runtime (seconds) of the command
commandthe pipe-command
argstcl-list of the pipe-command arguments
Returns
the command result
1 tpco_sendECMD $hd 1 pipecmd_sum [list 100 200]

Referenced by T4X::SOAP::CLIENT::callSoapOperation(), ITK::connect2TcDB(), T4X::JAVASERVER::eExecute(), T4X::JAVASERVER::execute(), T4X::JAVASERVER::sExecute(), and ITK::stopPipeServer().

◆ tpco_sendECMD2()

tpco_sendECMD2

This function sends a command to a pipe-server and receives the result.

Parameters
handle-idthe pipe handle
timeoutthe max runtime (seconds) of the command
commandthe pipe-command
argspipe-command arguments as tcl command args
Returns
the command result
1 tpco_sendECMD2 $hd 1 pipecmd_sum 100 200