Raritan Computer SX4 사용자 설명서

다운로드
페이지 172
A
PPENDIX 
H:
 
TCL
 
P
ROGRAMMING 
G
UIDE 
 149 
 
 
Basic TCL Server Example 
 
while (1) { 
amppermission off 
set s "" 
set s [amplisten] 
if {[string length $s] !=0} { 
puts $s 
ampresponse 
}  
if {[string length $s] == 5} {  
amppermision on 
break 

 
Script Function Description: 
This TCL Server will echo back any strings from any client who connects to the TCL interpreter through 
the TCL Scripting Window. 
 
Key programming points: 
amplisten checks to see if there is a new command from any client. 
Puts will push back the response to the output buffer. 
ampresponse will push the previous response back to the EXACT client who sent the command. 
Due to security, the TCL scripting feature is not normally accessible by Operators or Observers.  However, 
for the TCL Server to be general, Operators and Observers need access to the TCL scripting feature. 
amppermission allows such communication.  Also, when reset, amppersmission will, by default, be on. 
(Hence, only explicit “unlocks” by the Administrator are allowed.)