★★★为何我的recv()一次只能接1460字节以下?哪里需要设置?详细见内。

baobao 2002-08-07 12:44:57
server想client发25000字节,可client一次只能接1460或更少,这样还要client经过多次组装才能使用(降低了速度)。
一次一定可以接更多,要不pch最大1460好了。

m_hSocket=socket(AF_INET, nType, 0)

.....

int nBytesReceived;
nBytesReceived = recv(m_hSocket, pch, nSize, 0);
...全文
425 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jobine 2002-08-07
  • 打赏
  • 举报
回复
文档http://www.csdn.net/develop/Article/14/14641.shtm中有说明
tcice 2002-08-07
  • 打赏
  • 举报
回复
TCPSegMentSize是发送接受时单个数据报的最大长度,系统默认为1460,收发缓冲大小为8192。

在SOCK_STREAM方式下,如果单次发送数据超过1460,系统将分成多个数据报传送,在对方接受到的将是一个数据流,应用程序需要增加断帧的判断。当然可以采用修改注册表的方式改变1460的大小,但MicrcoSoft认为1460是最佳效率的参数,不建议修改。
ksyou 2002-08-07
  • 打赏
  • 举报
回复
没办法,只能这样,up
hongyucn 2002-08-07
  • 打赏
  • 举报
回复
MTU (Maximum Transfer Unit) specifies the maximum transmission unit size of an interface. Each interface used by TCP/IP may have a different MTU value specified. The MTU is usually determined through negotiation with the lower driver, using that lower driver value. However, that value may be overridden.

Each media type has a maximum frame size that cannot be exceeded. The link layer is responsible for discovering this MTU and reporting it to the protocols above. NDIS drivers may be queried for the local MTU by the protocol stack. Knowledge of the MTU for an interface is used by upper layer protocols such as TCP, which optimizes packet sizes for each medium automatically.

If a network interface card (NIC) driver such as an ATM driver uses LAN emulation mode, it may report that it has an MTU higher than what is expected for that media type. For instance, it may emulate Ethernet but report an MTU of 9180 bytes. Windows NT accepts and uses the MTU size reported by the adapter even when it exceeds the normal MTU for a given media type.

Below is a list of Default MTU size for different media.



Network MTU(Bytes)
-----------------------------------
16 Mbit/Sec Token Ring 17914
4 Mbits/Sec Token Ring 4464
FDDI 4352
Ethernet 1500
IEEE 802.3/802.2 1492
X.25 576
lakegogo 2002-08-07
  • 打赏
  • 举报
回复
因为TCP的缘故,限定了每个分组的大小为1460。

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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