sizeof sockaddr_in +16是什么意思?

老白2018 2016-06-23 11:50:36
sizeof(lpOutputBuffer) - 2*(sizeof sockaddr_in +16),也就是说总长度减去两个地址空间的长度就是了
最近在研究完成端口这段看不明白,sockaddr_in是地址可为什么要加上16?
...全文
692 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
亚细亚 2019-07-15
  • 打赏
  • 举报
回复
引用 3 楼 老白2018 的回复:
[quote=引用 2 楼 Saleayas 的回复:]
sizeof 是关键字,所以 sizeof(T) sizeof T 是一样的。
sizeof sockaddr_in + 16 是说 sockaddr_in 的大小再加上 16 。

为什么要加上16才是一个地址空间?[/quote]
我也想不明白,为什么要加上16?
Tec-shrip 2019-04-19
  • 打赏
  • 举报
回复
The buffer size for the local and remote address must be 16 bytes more than the size of the sockaddr structure for the transport protocol in use because the addresses are written in an internal format
码农(假) 2017-07-26
  • 打赏
  • 举报
回复
AcceptEx/GetAcceptExSockaddrs 这两个函数 参数要求的 ,参数需求长度 必须 为 地址长度+16字节 dwLocalAddressLength The number of bytes reserved for the local address information. This value must be at least 16 bytes more than the maximum address length for the transport protocol in use. dwRemoteAddressLength The number of bytes reserved for the remote address information. This value must be at least 16 bytes more than the maximum address length for the transport protocol in use. Cannot be zero.
老白2018 2016-06-24
  • 打赏
  • 举报
回复
引用 2 楼 Saleayas 的回复:
sizeof 是关键字,所以 sizeof(T) sizeof T 是一样的。 sizeof sockaddr_in + 16 是说 sockaddr_in 的大小再加上 16 。
为什么要加上16才是一个地址空间?
Saleayas 2016-06-24
  • 打赏
  • 举报
回复
sizeof 是关键字,所以 sizeof(T) sizeof T 是一样的。 sizeof sockaddr_in + 16 是说 sockaddr_in 的大小再加上 16 。
threenewbee 2016-06-24
  • 打赏
  • 举报
回复
16到底在括号里还是括号外?
wanghui0380 2016-06-24
  • 打赏
  • 举报
回复
这个的看协议是什么,

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧