What value will recv() return if it receives a valid TCP packet with payload sized 0
问题 In TCP socket programming, if recv() returns 0, it is taken as an indication that the other side closed its connection. However, AFAIK, the TCP RFC does not mandate the payload of TCP to be > 0. So, theoretically, a TCP stack can receive a message with payload 0. So, essentially my question is what will recv() returns if it receives a packet of payload sized 0? If it returns 0, then how do we distinguish it from a closed connection indication. 回答1: TCP segments with a payload size of 0 are