There is no suitable tool, only some test cases described in text.
To measure TCP, most cases to establish a normal TCP connection, then send some test data on this connection, of course, these data include correct and problematic, then see if the other party returns to the message compliance with the agreement of.
However, the error packet to be sent is primarily to set some of the wrong data for some fields of the TCP header. Therefore, the most convenient method through the Windows Socket API is obviously not feasible, because there is no way to control the data in the head structure.
Now there is a packet gernerator that is made by others, this thing is used to send a packet, use WinPCAP, so you can set the header data in each level. However, the problem is to establish a TCP connection, you need to get the other party's initial Sequence Number, which is unpredictable, so there is no way to manually establish a connection through this baggage tool.
Originally considering the IP header and TCP header, then send SYN packets, then send SYN packets, then receive the SYN of the other party reply, after the ACK packet, according to the content of the message to construct the last ACK of the connection Packet. It seems that there is no problem on the idea, but actually tested the problem: The system kernel will also receive the SYN, ACK packet sent back from the other party, so before I construct the ACK packet, the protocol stack in the system will receive This SYN, ACK message replied to a RST message, so that I have a hard-working ACK message ...
After discovering this problem, find a solution around, and find how to let the system kernel do not interfere with my program in Winsocket's documentation. Now there is only one road, just use WinPCAP to achieve the purpose I want. Because WinPCAP can cut messages on the underlying network card, you may have to send the message to the system protocol stack, or send my packet before the system protocol stack makes it responding to the message. However, there is still a problem, that is, it is not possible that the first method can be implemented, that is, I don't know that WinPCAP can do this. For the second method, there are two problems. One is not known to send my packet before the system is sent, and the second is if the establishment is connected, receive an RST message, Will it break the connection? (In accordance with my thoughts, you should interrupt it. Because the ACK packet does not take up the serial number, the ACK NUM in the ACK and the system I sent is effective for the other party, no matter which one is First, this will have an established connection RST.)
It's really a lot of questions!
Try to see if I will try it tomorrow, I will know the result.