How to use the C socket API in C++ on z/OS

前端 未结 9 793
闹比i
闹比i 2021-02-01 11:23

I\'m having issues getting the C sockets API to work properly in C++ on z/OS.

Although I am including sys/socket.h, I still get compile time errors telling m

9条回答
  •  清歌不尽
    2021-02-01 12:06

    Keep a copy of the IBM manuals handy:

    • z/OS V1R11.0 XL C/C++ Programming Guide
    • z/OS V1R11.0 XL C/C++ Run-Time Library Reference

    The IBM publications are generally very good, but you need to get used to their format, as well as knowing where to look for an answer. You'll find quite often that a feature that you want to use is guarded by a "feature test macro"

    You should ask your friendly system programmer to install the XL C/C++ Run-Time Library Reference: Man Pages on your system. Then you can do things like "man connect" to pull up the man page for the socket connect() API. When I do that, this is what I see:

    FORMAT

    X/Open

    #define _XOPEN_SOURCE_EXTENDED 1
    #include 
    
    int connect(int socket, const struct sockaddr *address, socklen_t address_len);
    

    Berkeley Sockets

    #define _OE_SOCKETS
    #include 
    #include 
    
    int connect(int socket, struct sockaddr *address, int address_len);
    

提交回复
热议问题