TCP套接字服务器c++/c窗口大小
TCP socket server c++/c window size
我在树莓派上创建了一个小型c++/c http套接字服务器。在过去,我一次只发送/接收1460个数据字节。虽然最近我意识到我可以发送更多。我想发送数据从服务器到客户端尽可能快。我是否可以获得客户端可以处理的窗口大小(最大段大小),以便我可以发送该数量的数据。假设它是8192,那么我想在每个服务器套接字发送上传输这个数量。谁能给我点建议,告诉我该怎么做?
在TCP_MAXSEG中使用getsockopt:
int mss;
socklen_t len = sizeof mss;
getsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &mss, &len);
From man tcp
:
TCP_MAXSEG The maximum segment size for outgoing TCP packets. In Linux 2.2 and earlier, and in Linux 2.6.28 and later, if this option is set before connection establishment, it also changes the MSS value announced to the other end in the initial packet. Values greater than the (eventual) interface MTU have no effect. TCP will also impose its minimum and maximum bounds over the value provided.
根据这个问题,应该在连接建立后执行此操作,否则将返回一个通用的默认值
相关文章:
- SDL2 调整窗口大小后如何缩放鼠标坐标?
- 如何设置与其背景图像大小相对应的窗口大小?
- 如何防止opengl绘图拉伸到窗口大小?
- 使用 Win32 将 GDI 绘制大小缩放为窗口大小
- 恢复Qt窗口大小和位置问题
- 与WM_DPICHANGED消息一起发送的建议窗口大小太大
- 快板获取当前窗口大小
- 当窗口大小更改时,如何自动缩放QT中的图表
- 尝试在 win 32 中禁用窗口大小调整时,窗口样式行为不一致
- OpenGL纹理闪烁/有时在窗口大小上移动
- QGraphics手动调整窗口大小后场景宽度/高度没有变化
- Qt - 防止在拖动标题栏时调整窗口大小
- 在 Direct2D 绘图中,调整窗口大小后尺寸会更改
- 在窗口大小上绘制的OpenGL消失
- XDG-Shell:如何更改窗口大小
- WinAPI.检查窗口大小调整是否已完成
- Win32 透明全屏仅在窗口大小溢出桌面时才有效
- 如何设置启用setFixize后再次调整主窗口大小
- C ,QT,防止窗口大小大于实际布局高度
- 使用第二个线程快速更新 GUI 窗口会通过调整窗口大小或移动窗口而崩溃