开发者

Effect of TCP_CORK

I'm having a use case where I'm sending data via TCP/IP in one direction. I'm doing this via multiple send()-calls with very small 开发者_如何转开发(in relation to the size of an ethernet frame) payloads (without any flags for the send()-call). To prevent bloating up my small payload packets to the size of a full ethernet frame, I thought it would be nice to use the TCP_CORK socket option. This works, but when actually comparing the situation before and after using TCP_CORK, I noticed that this kind of aggregation was already done. Why is this so? As I said, I do not use any flags for send() (like MSG_MORE) or other socket options, so I would have expected my original solution to be wasteful.


If you are sending messages very quickly you may be seeing the Nagle algorithm at work. You have to disable it explicitly. Iirc in linux you have to set TCP_NODELAY, but there are different options in other operating systems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜