BPX4TAK (takesocket) example

The following code takes a socket that was given by the program identified by CID (clientid). SOCKDESC and CID information are passed by the program that did the givesocket (BPX4GIV). SOCKDESC is the giver's descriptor. When takesocket completes successfully, RETVAL will contain the taker's new socket descriptor. For the callable service, see takesocket (BPX1TAK, BPX4TAK) — Acquire a socket from another program. For the data structure, see BPXYCID — Map the returning structure for getclientid(). AMODE 31 callers use BPX1TAK (takesocket) example.
                                              
         CALL  BPX4TAK,              take a socket from another program+
               (CID,                 Input: Clientid of giver          +
               SOCKDESC,             Input: Giver's socket descriptor  +
               RETVAL,               Return value: -1 or new descriptor+
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ---------------------------------- 
         L  R2,RETVAL                                                   
         ST R2,SOCKDES2              Store the new socket descriptor