I was just trying out the code snippet here for fun and learning. I did a wireshark capture on the interface and noticed something strange.
The SYN packets were sent out as expected and I seem to be receiving SYN ACKs in response. I have a sleep of about 5 seconds each after sending each SYN packet. I notice that my machine sends a RST packet to the server after receiving each SYN ACK even though there is no code for the same. Why does that happen and how could I prevent that from happening?