ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
problem:
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
wrongman
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.