socket(AF_INET,SOCK_STREAM,0)

socket(AF_INET,SOCK_STREAM,0)c++socket的这个固定格式是起什么作用... socket(AF_INET,SOCK_STREAM,0) c++ socket 的这个固定格式是起什么作用 展开
 我来答
rezood
2008-02-21 · TA获得超过329个赞
知道小有建树答主
回答量:527
采纳率:0%
帮助的人:332万
展开全部
生成一个TCP的socket

Function: int socket (int namespace, int style, int protocol)
This function creates a socket and specifies communication style style, which should be one of the socket styles listed in 16.2 Communication Styles. The namespace argument specifies the namespace; it must be PF_LOCAL (see section 16.5 The Local Namespace) or PF_INET (see section 16.6 The Internet Namespace). protocol designates the specific protocol (see section 16.1 Socket Concepts); zero is usually right for protocol.

The return value from socket is the file descriptor for the new socket, or -1 in case of error. The following errno error conditions are defined for this function:

EPROTONOSUPPORT
The protocol or style is not supported by the namespace specified.

EMFILE
The process already has too many file descriptors open.

ENFILE
The system already has too many file descriptors open.

EACCES
The process does not have the privilege to create a socket of the specified style or protocol.

ENOBUFS
The system ran out of internal buffer space.
The file descriptor returned by the socket function supports both read and write operations. However, like pipes, sockets do not support file positioning operations.
flyskyzhou
2008-02-21
知道答主
回答量:9
采纳率:0%
帮助的人:1.3万
展开全部
找本socket的书看下吧
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式