Win21H1 (19043.1110) Win10 Pro 64Bit, and seen on 20H2, office PCs.
While sending data greater than the MTU with Winsock2 and TCP sometimes i experience that the last two packets of the stream are "retransmitted". Only that the resend packet contains the data of the 2nd last packet combined with the last packet and with a data offset of the last packet and an increased sequence number of the last packet - so it is not wrong data, but no typical retransmission where the same packet with the same data and sequence is sent.
I have not found any pattern to make this happen. It occures about every 5 to 15 times when sending the first data packet.
What i can say is, that after i connect to the peer and when i get this behaviour, i get it for a few (maybe even all the time, not tested) packets. A disconnect and reconnect, or sending data with a different size eliminates this behaviour.
Heres the sequence of what I've done and tried. I mixed all variants, the programm executes everything - except WSAStartup - in the same thread.
Initialization:
1. WSAStartup (2,2)
2. Winsock2.socket(AF_Inet,SOCK_STREAM,IPPROTO_TCP) and IPPROTO_IP
3. WSAIOCTL with FIONBIO to set it non-blocking
4. setsockopt to SOL_SOCKET, SO_REUSADDR FALSE
5. setsockopt IPPROTO_TCP TCP_NODELAY to enable and disable Nagle
6. bind with and without
7. connect - in non blocking with a select loop to check if valid
8. setsockopt SOL_SOCKET SO_SNDTIMEO to check if it's some RTO thingy
9. setsockopt SOL_SOCKET SO_RCVTIMEO
10. Here my programm loops through select fd_rcv to check if I got data
Data Send:
setsockopt SOL_SOCKET SO_SNDBUF - made no difference, it's said that the newer version should not need it
some select to see if fd_write is ok
send - Tried WSASend too, no lappend
The programm continues polling select to see if rcv data is ready




