Programming with RSK Sockets
Programming with the RSK socket library involves the following steps:
- In each of your PL/X compilation units that will use the RSK socket library,
you must include the RSK socket library language binding
macro. To do so, put the following statement into each compilation unit:
%include syslib(plxsock);PLXSOCK COPYis inDMSRP MACLIB, which is part of the z/VM® PL/X Restricted Source Feature, which you can order as a feature of z/VM. - At run-time, your first step must be to initialize the RSK socket library. This prepares the library to receive socket calls. To initialize the library, you must either call PS_libinit() yourself or arrange for the RSK to call it. See PS_libinit for more information.
- To perform socket operations, you must create a socket
set. 1 We
call each RSK socket set an application and hence
the entry point you use for this is PS_applinit().
You supply PS_applinit() with the name (VM user ID) of the TCP/IP stack machine, a unique name for your new set of sockets, and the number of sockets you want in the set.
PS_applinit() establishes the IUCV connection to the TCP/IP stack machine and prepares the socket set for your use.
- You perform operations on the sockets in your set. You use the RSK socket library entry points to do so. For example, to allocate a new socket, you call PS_socket(), or to write data to a socket, you call PS_write().
- When you are done with your set of sockets, you dispose of it by calling PS_applterm(), identifying the socket set by the unique name you chose for it at its creation.
- Prior to your server ending, either you should call PS_libterm() or you should arrange for the RSK to call it. See PS_libterm for more information.
1 In IUCV sockets, this step corresponds to establishing a connection
to the TCP/IP stack machine and sending the initial message. In Rexx/Sockets,
this step corresponds to invoking
Socket('Initialize').