
功能:
开启热点
关闭热点
开机自动开启热点
不知道校园网环境下好不好使
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
1 | $ hexo new "My New Post" |
More info: Writing
1 | $ hexo server |
More info: Server
1 | $ hexo generate |
More info: Generating
1 | $ hexo deploy |
More info: Deployment
| 步骤 | TCP | UDP |
|---|---|---|
| Socket 创建 | socket(AF_INET, SOCK_STREAM, 0) |
socket(AF_INET, SOCK_DGRAM, 0) |
| 绑定地址 | 需要 bind()(服务端) |
需要 bind()(服务端) |
| 连接管理 | 服务端:listen() + accept()客户端:connect() |
无连接管理,直接收发数据包 |
| 数据收发 | send()/recv() 或 write()/read() |
sendto()/recvfrom()(需指定目标地址) |
| 关闭连接 | close()(需处理四次挥手) |
直接 close()(无连接状态) |
listen() + accept() 建立连接池,每个客户端连接会生成一个新的 socket。recvfrom() 获取客户端地址。send()/recv(),数据像水流一样连续,无明确边界(需应用层处理粘包问题)。sendto()/recvfrom(),每个数据包独立且完整,自带地址信息。accept() 返回一个独立 socket)。recvfrom() 获取不同客户端的地址)1 | // 客户端连续发送两次数据 |
1 | // 客户端发送两次数据 |