Click here to Skip to main content
15,891,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm looking for an alternative to windows sockets for network packet sniffing.

Windows sockets is sometimes not reliable (on one of my servers, it only captures incoming packets...)

What I want: A way to sniff packets without any special driver.
WinPcap (or sth. near it) is my last opportunity - I would like to take a driverless solution first.

OS: support for Win2K through to Win7 is needed.
I'm using Borland C++ (please don't ask why) - so I can't use any .NET solution.

Any suggestions?

TIA
Posted
Updated 7-Jun-11 22:13pm
v3
Comments
Albert Holguin 8-Jun-11 10:37am    
I've used windows sockets for streaming and capturing all sorts of data and never had a reliability problem, maybe there's something wrong in your implementation and code.

I do not thing this is possible. The closet solution I can think of, is to use a managed switch that can do port mirroring / replication.

You setup a port in the switch to duplicate all traffic to another port. On this port you have a computer setup with WireShark (using WinPcap). If you do not what to use IP protocol, the remove/disable it on the computer where capturing will happen.
 
Share this answer
 
It would probably be easier to suggest something if we knew what you want it for. Why not simply set up a logging proxy for the program you want to investigate?
 
Share this answer
 
If you don't want to use sockets (which as you pointed out are not reliable) you will need a kernel mode solution (i.e a network driver).

get hold of the latest WDK and look at the NDIS API.

supporting bot Pre-vista and Post - vista OS is gonna be a problem since post vista Operating systems make use of NDIS 6 while pre vista will use NDIS 5.

Note: you can run an NDIS 5 drivers on post vista OSs but its not recommended.

if you don't want to develop a driver (which isn't easy) you can use an open source one like winpcap which is used by wireshark
 
Share this answer
 
The problem is not the Winsock, but the network card: unless placed in promiscuous mode by its driver, doesn't interrupt the OS if the incoming packet has a MAC destination not pertinent to the receiving card.

Without installing a driver that does that setup and takes care to buffer the incoming packets, what you're asking is impossible.

And even if you do so, if your computer is attached to a switched network, it will nor receive (since the network doesn't sent them, unless specifically instructed) packets sent to different destinations.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900