How to Listen on tcp port without it answering?

232 views Asked by At

I been implementing a packet forwarder in C, and stumbled with this interesting issue.

I noticed that if i listen on tcp port with winsock, it sends back a syn-ack when a syn is recieved. If i dont listen, its sends rst-ack to indicate that the port is closed. I wish that the port wont answer at all, because i'm sniffing directly on the interface with winpcap.

Is there any solution or workaround to my problem? I had the same problem with UDP, but of course opening the port fixed it and prevented ICMP host unreachable. Now i nedd a solution to TCP.

Thanks

1

There are 1 answers

5
tyChen On

If you want to forward a packet without making connection, then it's better to use iptables to desgin some rules. TCP is a reliable transmission protocol, which means if you want to receive packets(it doesn't care if you want to use it or just forward), then it must estalishes a connection with three way handshake.