socket()
来源:互联网 发布:新纳粹知乎 编辑:程序博客网 时间:2024/06/05 15:54
头文件:
#include <sys/types.h> /* See NOTES */ #include <sys/socket.h>
函数原型:
int socket(int domain, int type, int protocol);
函数说明:
创建一个通信端点,并返回一个设备描述符。
domain:指定一个通信域;
-可取的值:
Name Purpose Man page AF_UNIX, AF_LOCAL Local communication unix(7) AF_INET IPv4 Internet protocols ip(7) AF_INET6 IPv6 Internet protocols ipv6(7) AF_IPX IPX - Novell protocols AF_NETLINK Kernel user interface device netlink(7) AF_X25 ITU-T X.25 / ISO-8208 protocol x25(7) AF_AX25 Amateur radio AX.25 protocol AF_ATMPVC Access to raw ATM PVCs AF_APPLETALK AppleTalk ddp(7) AF_PACKET Low level packet interface packet(7) AF_ALG Interface to kernel crypto API
type:套接字的指定类型。
-可取的值:
SOCK_STREAM Provides sequenced, reliable, two-way, connection-based byte streams. An out-of-band data transmission mecha‐ nism may be supported. SOCK_DGRAM Supports datagrams (connectionless, unreliable messages of a fixed maximum length). SOCK_SEQPACKET Provides a sequenced, reliable, two-way connection- based data transmission path for datagrams of fixed maximum length; a consumer is required to read an entire packet with each input system call. SOCK_RAW Provides raw network protocol access. SOCK_RDM Provides a reliable datagram layer that does not guar‐ antee ordering. SOCK_PACKET Obsolete and should not be used in new programs; see packet(7).
protocol:指定特别的socket协议,通常为0.
阅读全文
0 0
- socket
- socket
- Socket
- Socket
- Socket
- Socket
- Socket
- Socket
- socket
- Socket
- Socket
- Socket
- Socket
- socket
- socket
- socket
- socket
- socket
- linux中断与系统调用
- Java中的24种设计模式与7大原则
- Java的基础语法(1)
- 数据结构--二叉排序树
- C++中的istringstream 的用法
- socket()
- java常量池和运行时常量池
- JS学习之数组;
- 9.8.3 消除消失的编号
- 中国性别平等,要等到卫生棉条普及的那一天
- python批量获取html内body内容
- 获取安卓设备UUID
- 项目整理
- Apache的ActiveMQ