Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/692451a2-4ecc-800b-b601-8d7b09eea462
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== 一、你这轮回答的总结 ==== # 服务器端 bind 与 listen - 你明确理解了 bind() 的作用:指定服务器 IP 和端口,使客户端知道连接目标。 - 你理解了 TCP 必须在三次握手开始前确定目的端口,否则客户端无法连接。 - 你明白了为什么客户端可以不 bind,让操作系统分配临时端口:客户端发起的是临时连接,不提供持续服务。 # recv 与 send 的行为 - 你理解了 TCP 是面向字节流的协议,send() 不保证对应应用层“消息边界”,接收端可能需要多次 recv() 才能完整读取。 - 你提到了滑动窗口和阻塞控制发送数据的机制。 # 多客户端处理与 fork 模型 - 你理解了父进程关闭 connect_d、子进程关闭 listener_d 的原因:避免资源泄漏、保持设计语义正确。 - 你提到了引用计数和 TCP 连接释放依赖 FD 管理。 # 客户端 getaddrinfo 与 connect - 你抓住了它支持域名解析、兼容 IPv4/IPv6、简化代码和错误处理的优势。 - 你知道 getaddrinfo 可能返回多个 IP 地址,为客户端提供冗余和可靠性选择。
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)