协议学习:network网络:socket类型
差别
这里会显示出您选择的修订版和当前版本之间的差别。
| 两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 | ||
| 协议学习:network网络:socket类型 [2022/02/09 08:42] – zhangguo | 协议学习:network网络:socket类型 [2026/10/13 22:51] (当前版本) – 外部编辑 127.0.0.1 | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | ====== | + | # socket类型 |
| + | [TCP和UDP的区别(Socket)](https:// | ||
| + | |||
| + | |||
| + | ``` | ||
| + | AF_UNIX(本机通信) | ||
| + | AF_INET(TCP/ | ||
| + | AF_INET6(TCP/ | ||
| + | 其中 “type”参数指的是套接字类型,常用的类型有: | ||
| + | SOCK_STREAM(TCP流) | ||
| + | SOCK_DGRAM(UDP数据报) | ||
| + | SOCK_RAW(原始套接字) | ||
| + | ``` | ||
| https:// | https:// | ||
| 行 19: | 行 32: | ||
| - | ===== - python socket | + | ## - python socket |
| - | < | + | |
| + | ``` | ||
| socket.socket(family=AF_INET, | socket.socket(family=AF_INET, | ||
| - | </ | + | ``` |
| Create a new socket using the given address family, socket type and protocol number. The address family should be AF_INET (the default), AF_INET6, AF_UNIX, AF_CAN, AF_PACKET, or AF_RDS. The socket type should be SOCK_STREAM (the default), SOCK_DGRAM, SOCK_RAW or perhaps one of the other SOCK_ constants. The protocol number is usually zero and may be omitted or in the case where the address family is AF_CAN the protocol should be one of CAN_RAW, CAN_BCM or CAN_ISOTP. | Create a new socket using the given address family, socket type and protocol number. The address family should be AF_INET (the default), AF_INET6, AF_UNIX, AF_CAN, AF_PACKET, or AF_RDS. The socket type should be SOCK_STREAM (the default), SOCK_DGRAM, SOCK_RAW or perhaps one of the other SOCK_ constants. The protocol number is usually zero and may be omitted or in the case where the address family is AF_CAN the protocol should be one of CAN_RAW, CAN_BCM or CAN_ISOTP. | ||
协议学习/network网络/socket类型.1644367351.txt.gz · 最后更改: (外部编辑)
