Restrictions for using z/OS TCP/IP API with z/OS UNIX

The restrictions can be grouped into categories:
  • Header Files
    • Header file conflicts between TCP/IP and z/OS® XL C/C++. z/OS XL C/C++ and TCP/IP have header files with the same name and overlapping function. For example, both have a types.h file. If you use TCP/IP API functions in your application but the z/OS XL C/C++ header file is searched for and used, the TCP/IP function does not work as intended.
      You can circumvent this problem by developing your application program with separate compilation source files for TCP/IP function and normal z/OS XL C/C++ function. You can then compile the TCP/IP source files separately from the normal z/OS XL C/C++ source files. Use the c89 -I option to point to the MVS™ data sets to search for the TCP/IP header files. Finally, you can bind all the application object files together to produce the application executable file. For the bind step, use the c89 -l option to point to the correct TCP/IP libraries on MVS. For example:
      c89 -I "//'tcpip.sezacmac'" pgm.c -l "//'tcpip.sezarnt1'" …
  • TCP/IP socket API. Both z/OS UNIX POSIX.1-defined support and the TCP/IP for z/OS socket API use a small subset of common function calls that cannot be resolved correctly between them:
    • close()
    • fcntl()
    • read()
    • write()

    Use of these calls should be reserved for one or the other, but not both, of these programming interfaces. For example, if an application program is written to use the open(), close(), read(), and write() functions for z/OS TCP/IP socket communication, it cannot use them for UNIX file system file access. z/OS XL C/C++ stream I/O functions (fopen(), fclose(), fread(), and fwrite()) must be used for UNIX file system file access. See z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference for more information.

  • Creating child processes. Generally speaking, an application program cannot have a parent process open resources—in this case sockets—and then support those resources for a child process created through a fork() function or in a process following use of an exec function. The new child process does not inherit sockets from the parent process if forked. If the child process needs sockets, it must request TCP/IP for z/OS socket support independently of the parent process. In fact, if a child process is to be forked by an application program using TCP/IP sockets under z/OS UNIX, all MVS resources to be opened should be opened by the child process rather than by the parent process.
  • TCP/IP configuration file access. An application executable file that uses TCP/IP APIs and was bound with the c89 utility cannot locate the necessary TCP/IP configuration files, because they reside in MVS sequential data sets rather than in UNIX file system files.
    To circumvent this problem, have the system programmer copy the TCP/IP configuration data sets into the root directory exactly as shown:
    OPUT 'tcpip.tcpip.data' 'etc/resolv.conf' text

    Copy the address of the name server, the name, and the domain name from tcpip.HOST.LOCAL to \etc\hosts. You should not copy the entire file directly because you only need the address and name. The entry in the \etc\hosts file follows the BSD format. The case of the filenames and the use of the quote characters as part of the name are significant. Use the TSO/E OPUT command to copy the MVS sequential data sets to the root directory. (Placing files in the root file system requires superuser authority.)

  • Program reentrancy.The TCP/IP sockets and X Windows reentrant libraries must have a special C370LIB-directory member created for them before an application program using TCP/IP functions can be bound. The system administrator must run the C370LIB DIR function against the reentrant libraries to create it. The system administrator must do this once per library for an MVS system.
    Specify the TCP/IP libraries to search on the c89 utility when binding the application program. For example:
    c89 -I"//'tcpip.sezacmac'" pgm.c -l "//'tcpip.sezarnt1'" …

    For information on C370LIB, see z/OS XL C/C++ User's Guide.