C++20要加入反射,这让我想起了之前跟别人讨论 RTTI 和反射哪个更邪教的时候还在说 C++ 应该不会有反射吧结果 C++20 啪啪啪打脸。
其实真正比较期待的是 coroutine 和 networking,module我觉得有戏但是兼容性怎么解决?
  其实真正比较期待的是 coroutine 和 networking,module我觉得有戏但是兼容性怎么解决?
  How2Code
我们都知道TCP的SEQ是循环使用的,那么怎么判断SEQ1是不是在SEQ2之前呢?
这里其实有一个要考虑的问题是,在2**32-1范围内的任意SEQ值都有可能因为网络原因而在此刻到达,因此有一些隐含条件(可以见RFC793/5961)
  
  How2Code
Linux内核的实现,简直赏心悦目
另外如果假设seq空间是从0开始的一个圆,这里有一个前提是只有顺时针距离在2**31以内的才算before,不然就是after了——当然,这是非常合理的,也是本应该的效果。
  
  How2Code
另外如果假设seq空间是从0开始的一个圆,这里有一个前提是只有顺时针距离在2**31以内的才算before,不然就是after了——当然,这是非常合理的,也是本应该的效果。
TCP determines if a data segment is "old" or "new" by testing whether its sequence number is within 2**31 bytes of the left edge of the window, and if it is not, discarding the data as "old".  To insure that new data is never mistakenly considered old and vice-versa, the left edge of the sender's window has to be at most 2**31 away from the right edge of the receiver's window.Similarly with the sender's right edge and receiver's left edge.Since the right and left edges of either the sender's or receiver's window differ by the window size, and since the sender and receiver windows can be out of phase by at most the window size, the above constraints imply that 2 * the max window size must be less than 2**31 ——RFC1323
  
            