0 在 socket() 系统调用中表示什么? [英] what does 0 indicate in socket() system call?

查看:26
本文介绍了0 在 socket() 系统调用中表示什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下行中的 0 表示什么?我可以使用哪些其他标志?

what 0 indicates in following line? what are other flags i can use?

server = socket(AF_UNIX, SOCK_STREAM, 0)

推荐答案

正如其他人所说,socket 的第三个参数通常是一个 int 指示协议.0 表示调用者不想指定协议,而是由服务提供者决定.

As others have likely said, the third argument to socket is generally an int indicating the protocol. 0 indicates that the caller does not want to specify the protocol and will leave it up to the service provider.

除了零之外,另一个常见的是IPPROTO_TCP.

Other than zero, another common one is IPPROTO_TCP.

在您的机器上使用 man 2 socket 或访问 此处.

Full details can be found on the man page using man 2 socket on your machine or visiting here.

这篇关于0 在 socket() 系统调用中表示什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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