在z / OS C ++中使用C套接字API [英] Using C socket API in C++ on z/OS

查看:181
本文介绍了在z / OS C ++中使用C套接字API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直有得到的ç套接字API 的问题在 C ++ 正常工作。具体来说,即使我包括 SYS / socket.h中,我仍然得到编译时错误告诉我, AF_INET 没有定义。我失去了一些东西很明显,或者可以此相关的事实,我正在做关于的z / OS 将此编码和更为复杂的问题,我的?

I've been having issues getting the C sockets API to work properly in C++. Specifically, even though I'm including sys/socket.h, I'm still getting compile time errors telling me that AF_INET is not defined. Am I missing something obvious, or could this be related to the fact that I'm doing this coding on z/OS and my problems are much more complicated?

更新:经进一步调查,我发现有一个 #IFDEF 是我打。显然的z / OS 不开心,除非我定义它的我使用的是与插座的类型的:

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

现在,我个人不知道这是什么 _OE_SOCKETS 实际上是对的,所以如果任何的z / OS 插座程序员那里(你们所有3),也许你可以给我一个破败的这一切是如何工作的?

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 on how this all works?

推荐答案

请在IBM手册的副本方便:

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

IBM出版物一般都非常好,但你需要习惯它们的格式,以及知道到哪里寻找答案。您可以通过功能测试宏

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"

您应该问你的友好系统程序员安装 XL C / C ++运行 - 时间库参考:手册页
你的系统上。然后,你可以做这样的事情的人连拉起套接字手册页连接()API。当我这样做,这是我所看到的:

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:

格式

在X / Open

#define _XOPEN_SOURCE_EXTENDED 1
#include <sys/socket.h>

int connect(int socket, const struct sockaddr *address, socklen_t address_len);

伯克利套接字

#define _OE_SOCKETS
#include <sys/types.h>
#include <sys/socket.h>

int connect(int socket, struct sockaddr *address, int address_len);

这篇关于在z / OS C ++中使用C套接字API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆