Making TCP service ignore a given port / socket
I'm trying to implement a TCP proxy process using RAW sockets between a client and a server on a given port: client <-> proxy <-> server.
I am currently receiving all incoming IP packets over a RAW socket on which I set the SIO_RECVALL ioctl. The problem is that when the client trys to connect to the proxy the TCP service on the proxy replies with a TCP RST segment because no TCP socket is listening on the destination port.
Is there a way to tell windows TCP service (using Winsock or some other API) to ignore a given port or the socket? - I did manage to get the TCP service to not answer the first TCP SYN segment by setting the SO_CONDITIONAL_ACCEPT option for a TCP socket I opened for listening with the given port but later TCP segments still cause the service to reset the connection.
If some has any idea please let me know,