ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I'm trying to write an application in C that estabilish a TCP connection
"the hard way", I mean, using raw sockets and so filling up all the ip and
tcp headers fields... after some days I'm almost finished but i've a
i send the first packet (the SYN one), the host B answer me with a packet
with flags SYN ACK, and until here, all goes well, but i can't send the
third packet with the last ACK... i sniffed with ethereal and i see this:
to send the data i tried to use the same socket used for the
first packet, then i tried creating another one... but the result is the
same... someone knows if I'm missing something?
thanks for the help
your host A tcp is responding to the SYN|ACK from host B with a RESET, as according to the TCP protocol. port 1234 on host A is not open, so it is not expecting to recieve random SYN|ACK packets, so when it recieve the reply it properly sends a RST. you can't do anything about that unless u hack up the protocol stack. or perahps u can use a iptables rule to drop outgoing RST packets from host A while u do ur testing.
the KERNEL LEVEL NETWORK PROTOCOL STACK, in follownig the tcp protocol, will SEND A RST whenever it receives a SYN|ACK on a closed port, or on an open port when it is not expecting to receive a SYN|ACK. when the client B computer receives this RST, it will then take the socket out of the SYN received state and put it back into LISTEN state. unless u make an iptables rules on client B that drops all incoming RST's , i dont see how to accomplish what you are doing.