On Linux, you would use an ioctl to put the network device into "promiscuous mode", where it would receive
all packets, and use raw mode to read them from there.
Other operating systems will handle this differently.
You might take a look at
darkstat, which implements generic traffic counting over an entire interface on Linux, OSX, Solaris, and Windows, probably in four different ways.
This does not bypass the switching issue. On a switched network, you won't get sent packets which aren't destined for you at all!