Prob in making valid TCP connection (using HPING, failed during 3-way handshaking)
Hello to all networking gurus. I have a problem in establishing a valid TCP connection during 3-way handshaking using HPING. As all of you know, to make a valid TCP connection, a 3-way handshaking is needed to be set up.
My case is, I need to send a customized TCP message (with data as a text string) to a piece of hardware that I'm testing. This hardware is full functional, and at least it was tested by a Mac machine and shows no problem, but now I am using Windows O/S and got a bit problem. FYI, I am running WinXP SP1 without any other patches, so I have access to raw sockets using HPING.
When I first send my TCP message with data to the hardware (command line is -- hping <dest IP> -p <dest port> -E <filename> -d <file length> -c 1), the hardware didn't reply, and I figured out it was because the message I sent has no flags up. Therefore, I know I need to establish a valid TCP connection between my PC and the hardware first, by 3-way handshaking. I expect I need to send a SYN-flagged tcp msg to the hardware, then it will reply with a SYN|ACK-flagged tcp msg, and I send another ACK-flagged tcp msg, then the TCP linkage will be set up and I can go ahead to send my TCP data msg with SYN|PSH-flagged.
OK, so I sent the SYN-flagged TCP msg w/o data to the hardware. DONE (command line is -- hping <dest IP> -p <dest port> -c 1 -S)
Hardware replied with a SYN|ACK-flagged TCP msg back to my PC, as expected. DONE
HERE, before I initiate the last step of the 3-way handshaking which is ACK-flagged, I see my PC replied with a RST-flagged msg to the hardware!! Dang... the TCP linkage could not be set up, and I could not send my data-filled tcp msg with SYN|PSH flags up..
My questions are:
1) Why my PC was sending a RST-flagged msg to the hardware after it received the SYN|ACK-flagged msg? Is it a HPING problem, or my PC problem?
2) What should I do if I want my PC stop sending RST-flagged msg to the hardware during the last step of the 3-way handshaking, and let it send a ACK-flagged msg to complete the TCP linkage?!
3) If HPING doesn't do this kind of job nicely, what program should I use to establish a valid TCP connection, and have it stay opened?