一 功能:
*socket():creates a endpoint for communication and return a descriptor.
二 格式:
(一)int socket(int family,int type,int protocol)
*成功:返回非负描述符,在Unix系统上套接字描述符用文件描述符实现。出错:返回-1.
(二)参数说明:
*family:指明协议族。如下图:
*type:指明套接字类型。如下图:
protocol:指明协议。例如:IPPROTO_TCP:TCP协议;IPPROTO_UDP:UDP传输协议。