packet blocking

hello,
any body know
how to block a packet but mind we are not using NDIS but using the winsock2.0 for our purpose but it is not working. Is there anyway out to block a packet. We have already succeded in sniffing the traffic but as mentioned have not been able to block them.Can we use WINPCAP?
Please help me in the solution of the problem and help with any material like API/WEBSITE/IDEA.
Thanks
[414 byte] By [summo] at [2007-11-18 1:40:21]
# 1 Re: packet blocking
Why dont you set the socket to blocking mode?
sm_ch at 2007-11-10 8:54:07 >
# 2 Re: packet blocking
As you're using a sniffer to detect the packets, I assume this isn't data that is being received by your own application.

So, are you trying to make some kind of firewall app, to prevent socket connections on specified ports, or are you trying to intercept data packets as they zip around the network and remove them before they reach their destination?
Lee Peart at 2007-11-10 8:55:17 >
# 3 Re: packet blocking
Originally posted by summo
hello,
any body know
how to block a packet but mind we are not using NDIS

Therein lies the problem....you'll need to write a NDIS intermediate miniport driver.
Mick at 2007-11-10 8:56:16 >
# 4 Re: packet blocking
I forgot to mention...

The winsock2 library is written to provide network communications at the application layer - not for manipulating network data at the transport layer. So, whatever the precise requirements of your project, winsock2 is the wrong way to go.
Lee Peart at 2007-11-10 8:57:10 >
# 5 Re: packet blocking
Thanx for the cooperation Sir.

Well Mr. Lee Peart we are receiving the data packets and actually want to intercept network traffic and block certain packets from reaching their destination. Plz suggest us the proper way to do so without the use of any intermediate driver(by just making TTL field =0).

If winsock2 is not a proper choice then suggest us the proper approach of doing so. We have also succedded in sniffing packets by using RAW SOCKETS. So we can convert on them.
Moreover If we enable windows2000 builtin router software and make this specific host the default gateway of all other systems then is it possible that by using RAW Sockets we can make the TTL of a packet 0 and discard it.

:cool:
summo at 2007-11-10 8:58:19 >
# 6 Re: packet blocking
My apologies Summo, unfortunately your request goes beyond my level of experience on network programming.

Hopefully there is someone else here that can answer your questions, but I think you will need to go down to the driver level for what you are trying to achieve.
Lee Peart at 2007-11-10 8:59:16 >