LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1013|回复: 1

recvfrom回复的数据包结构问题?

[复制链接]
发表于 2006-4-7 17:24:28 | 显示全部楼层 |阅读模式
对于这样一个recvfrom(recvfd, recvBuf, sizeof(recvBuf), 0, (struct sockaddr *)&recvaddr, &len)函数:
到底回复几个数据包,怎么会一个数据包存到recvBuf中,而recvaddr中有会有IP地址结构的一个信息呢?还有recvBuf中的IP头存的到底是什么东西?
发表于 2006-4-9 14:08:25 | 显示全部楼层
one packet for one call, if you use raw socket(also called packet), you will get the whole packet stored in the recvBuf. if you create tcp/udp socket, then the recvBuf will get data which follows the tcp/udp header(so you cannot find the ip information in this buffer), recvaddr is useful here to tell you the ip information about the remote host
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表