Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use the C socket API in C++ on z/OS
    primarykey
    data
    text
    <p>I'm having issues getting the C sockets API to work properly in C++ on <code>z/OS</code>.</p> <p>Although I am including <code>sys/socket.h</code>, I still get compile time errors telling me that <code>AF_INET</code> is not defined.</p> <p>Am I missing something obvious, or is this related to the fact that being on <code>z/OS</code> makes my problems much more complicated?</p> <hr> <p><strong>Update</strong>: Upon further investigation, I discovered that there is an <code>#ifdef</code> that I'm hitting. Apparently <code>z/OS</code> isn't happy unless I define which "type" of sockets I'm using with:</p> <pre><code>#define _OE_SOCKETS </code></pre> <p>Now, I personally have no idea what this <code>_OE_SOCKETS</code> is actually for, so if any <code>z/OS</code> sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?</p> <hr> <p>Test App</p> <pre><code>#include &lt;sys/socket.h&gt; int main() { return AF_INET; } </code></pre> <p>Compile/Link Output:</p> <pre><code>cxx -Wc,xplink -Wl,xplink -o inet_test inet.C "./inet.C", line 5.16: CCN5274 (S) The name lookup for "AF_INET" did not find a declaration. CCN0797(I) Compilation failed for file ./inet.C. Object file not created. </code></pre> <hr> <p>A check of sys/sockets.h does include the definition I need, and as far as I can tell, it is not being blocked by any #ifdef statements.</p> <p>I have however noticed it contains the following:</p> <pre><code>#ifdef __cplusplus extern "C" { #endif </code></pre> <p>which encapsulates basically the whole file. Not sure if it matters.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload