Skip to main content
improved formatting and fixed grammer
Source Link
digito_evo
  • 3.7k
  • 3
  • 26
  • 61

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 me that AF_INET is not defined.

Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated?

I discovered that there is ana #ifdef that I'm hitting. Apparently, z/OS isn't happy unless I define which "type" of sockets I'm using with:

#define _OE_SOCKETS

Now, I personally have no idea what this _OE_SOCKETS is actually for, so if any z/OS sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?

Test App:

#include <sys/socket.h>

int main()
{
    return AF_INET;
}

Compile/Link Output:

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.
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.

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.

I have however noticed it contains the following:

#ifdef __cplusplus
  extern "C" {
#endif

which encapsulates basically the whole file? Not sure if it matters.

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 me that AF_INET is not defined.

Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated?

I discovered that there is an #ifdef that I'm hitting. Apparently z/OS isn't happy unless I define which "type" of sockets I'm using with:

#define _OE_SOCKETS

Now, I personally have no idea what this _OE_SOCKETS is actually for, so if any z/OS sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?

Test App

#include <sys/socket.h>

int main()
{
    return AF_INET;
}

Compile/Link Output:

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.

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.

I have however noticed it contains the following:

#ifdef __cplusplus
  extern "C" {
#endif

which encapsulates basically the whole file? Not sure if it matters.

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 me that AF_INET is not defined.

Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated?

I discovered that there is a #ifdef that I'm hitting. Apparently, z/OS isn't happy unless I define which "type" of sockets I'm using with:

#define _OE_SOCKETS

Now, I personally have no idea what this _OE_SOCKETS is actually for, so if any z/OS sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?

Test App:

#include <sys/socket.h>

int main()
{
    return AF_INET;
}

Compile/Link Output:

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.

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.

I have however noticed it contains the following:

#ifdef __cplusplus
  extern "C" {
#endif

which encapsulates basically the whole file? Not sure if it matters.

deleted 86 characters in body
Source Link
Braiam
  • 4.5k
  • 11
  • 50
  • 83

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

Although I am including sys/socket.h, I still get compile time errorscompile time errors telling me that AF_INET is not definedAF_INET is not defined.

Am I missing something obvious, or is this related to the fact that being on z/OSz/OS makes my problems much more complicated?


 

Update : Upon further investigation, I discovered that there is an #ifdef that I'm hitting. Apparently z/OSz/OS isn't happy unless I define which "type" of sockets I'm using with:

#define _OE_SOCKETS

Now, I personally have no idea what this _OE_SOCKETS is actually for, so if any z/OSz/OS sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?


 

Test App Test App

#include <sys/socket.h>

int main()
{
    return AF_INET;
}

Compile/Link Output: Compile/Link Output:

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.

 

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.

I have however noticed it contains the following:

#ifdef __cplusplus
  extern "C" {
#endif

which encapsulates basically the whole file? Not sure if it matters.

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 me that AF_INET is not defined.

Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated?


 

Update : Upon further investigation, I discovered that there is an #ifdef that I'm hitting. Apparently z/OS isn't happy unless I define which "type" of sockets I'm using with:

#define _OE_SOCKETS

Now, I personally have no idea what this _OE_SOCKETS is actually for, so if any z/OS sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?


 

Test App

#include <sys/socket.h>

int main()
{
    return AF_INET;
}

Compile/Link Output:

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.

 

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.

I have however noticed it contains the following:

#ifdef __cplusplus
  extern "C" {
#endif

which encapsulates basically the whole file? Not sure if it matters.

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 me that AF_INET is not defined.

Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated?

I discovered that there is an #ifdef that I'm hitting. Apparently z/OS isn't happy unless I define which "type" of sockets I'm using with:

#define _OE_SOCKETS

Now, I personally have no idea what this _OE_SOCKETS is actually for, so if any z/OS sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?

Test App

#include <sys/socket.h>

int main()
{
    return AF_INET;
}

Compile/Link Output:

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.

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.

I have however noticed it contains the following:

#ifdef __cplusplus
  extern "C" {
#endif

which encapsulates basically the whole file? Not sure if it matters.

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

Although I am including sys/socket.h, I still get compile time errorscompile time errors telling me that AF_INET is not definedAF_INET is not defined.

Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated?


Update  : Upon further investigation, I discovered that there is an #ifdef that I'm hitting. Apparently z/OS isn't happy unless I define which "type" of sockets I'm using with:

#define _OE_SOCKETS

Now, I personally have no idea what this _OE_SOCKETS is actually for, so if any z/OS sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?


Test AppTest App

#include <sys/socket.h>

int main()
{
    return AF_INET;
}

Compile/Link Output:Compile/Link Output:

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.

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#ifdef statements.

I have however noticed it contains the following:

#ifdef __cplusplus
  extern "C" {
#endif

which encapsulates basically the whole file.? Not sure if it matters.

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 me that AF_INET is not defined.

Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated?


Update: Upon further investigation, I discovered that there is an #ifdef that I'm hitting. Apparently z/OS isn't happy unless I define which "type" of sockets I'm using with:

#define _OE_SOCKETS

Now, I personally have no idea what this _OE_SOCKETS is actually for, so if any z/OS sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?


Test App

#include <sys/socket.h>

int main()
{
    return AF_INET;
}

Compile/Link Output:

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.

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.

I have however noticed it contains the following:

#ifdef __cplusplus
  extern "C" {
#endif

which encapsulates basically the whole file. Not sure if it matters.

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 me that AF_INET is not defined.

Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated?


Update  : Upon further investigation, I discovered that there is an #ifdef that I'm hitting. Apparently z/OS isn't happy unless I define which "type" of sockets I'm using with:

#define _OE_SOCKETS

Now, I personally have no idea what this _OE_SOCKETS is actually for, so if any z/OS sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?


Test App

#include <sys/socket.h>

int main()
{
    return AF_INET;
}

Compile/Link Output:

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.

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.

I have however noticed it contains the following:

#ifdef __cplusplus
  extern "C" {
#endif

which encapsulates basically the whole file? Not sure if it matters.

Improved formatting
Source Link
Jax
  • 7.2k
  • 4
  • 30
  • 40
Loading
appended answer 37 as supplemental
Source Link
Loading
added 2 characters in body
Source Link
MD XF
  • 8.2k
  • 9
  • 45
  • 74
Loading
Rollback to Revision 6
Source Link
flogram_dev
  • 43k
  • 11
  • 109
  • 161
Loading
fixed grammar, improved formatting
Source Link
Loading
Cleaned up the language for clarity of purpose
Source Link
Jax
  • 7.2k
  • 4
  • 30
  • 40
Loading
Question Protected by dawg
appended answer 43 as supplemental
Source Link
Michael Myers
  • 192.6k
  • 47
  • 301
  • 297
Loading
edited tags
Link
paxdiablo
  • 888.3k
  • 243
  • 1.6k
  • 2k
Loading
edited tags; edited title
Link
Jax
  • 7.2k
  • 4
  • 30
  • 40
Loading
Source Link
Jax
  • 7.2k
  • 4
  • 30
  • 40
Loading