Hier noch das mitgelieferte Demoprogramm:

Code:
h dftactgrp(*no) actgrp(*new) bnddir('QZRDSSRV/QZRDSSRV')           
 *                                                                  
 * This is an example of a program that opens a connection, sends   
 * a message, displays the reply, and closes the connection.        
 *                                                                  
 /COPY SOCKSTD                                                      
 *                                                                  
 * The input parameters are designed to work with the CALL command. 
 * The port parameter is usually a 4 byte binary number, but the    
 * prototype for the TCPOPEN procedure will handle the conversion.  
 *                                                                  
d host            s             32                                  
d port            s             15p 5                               
d message         s             32                                  
 *                                                                  
d length          s             10i 0                               
d rc              s             10i 0                               
 *                                                                  
d reply           s             52                                  
 *                                                                  
 *   Entry parameters                                                   
 *                                                                      
 *   This routine gets called with three parameters:                    
 *      The system name                                                 
 *      The port number                                                 
 *      The message to send                                             
 *                                                                      
 *   This parameter should be passed to the TCPACPT API.                
 *                                                                      
c     *ENTRY        PLIST                                               
c                   PARM                    host                        
c                   PARM                    port                        
c                   PARM                    message                     
 *****************************************************************      
 * Main routine                                                         
 *****************************************************************      
 *                                                                      
 * Open a connection and automatically translate data from ASCII to EBC 
 * The remote CCSID value of 819 is a good ASCII CCSID.                 
 *                                                                      
c                   callp     tcpopen(host:port:0:819:rc)               
c                   if        rc = 0                                   
 *                                                                     
 * Send a message to the server delimited by a carriage return/linefeed
 *                                                                     
c                   callp     tcpsend(message:%len(%trim(message)):    
c                                     'C':' ':rc)                      
c                   if        rc = 0                                   
 *                                                                     
 * Receive the response message.                                       
 *                                                                     
c                   callp     tcprecv(reply:%size(reply):'C':' ':length
c                   if        rc = 0                                   
c                   eval      reply = %subst(reply:1:length)           
 *                                                                     
 * Display the response message.                                       
 *                                                                     
c     reply         dsply                                              
c                   endif                                              
c                   endif                                              
c                   endif                                              
 *                                                                     
 * Close the connection.                      
 *                                            
c                   callp     tcpclose(rc)    
c                   return