Click here to Skip to main content
Click here to Skip to main content

Network Sniffer

, 19 Jul 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
Network Sniffer

Sample Image - Sniffer.jpg


A "Packet Sniffer" is a utility that sniffs without modifying the network's packets in any way. By comparison, a firewall sees all of a computer's packet traffic as well, but it has the ability to block and drop any packets that its programming dictates. Packet sniffers merely watch, display, and log this traffic.

One disturbingly powerful aspect of packet sniffers is their ability to place the hosting machine's network adapter into "promiscuous mode." Network adapters running in promiscuous mode receive not only the data directed to the machine hosting the sniffing software, but also ALL of the traffic on the physically connected local network.

I hope that this piece of code will help you understand the network better.


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


About the Author

Eran Aharonovich
Software Developer
Australia Australia
Been a programmer since 1999.
Experience in:
.Net, C++, C#, VB, VB.NET, ASP, ASP.NET, DLLs, COM etc.

Comments and Discussions

Generalrunning the network sniffer Pinmemberujal13-Jul-06 7:18 
GeneralRe: running the network sniffer PinmemberEran Aharonovich13-Jul-06 7:27 
GeneralRe: running the network sniffer Pinmemberujal14-Jul-06 5:33 
Generaldisplay number of packets PinmemberdReAmWoNderS5-Jul-06 4:48 
QuestionMore fragments problem PinmemberWouter Dhondt18-Jun-06 5:06 
GeneralXP SP2 Problem Pinmemberjopus22-Jul-05 11:31 
GeneralI Get Inbound traffic only Pinmemberjopus28-Apr-05 20:23 
GeneralPlease help me! PinmemberdSolariuM29-Mar-05 4:45 
Does this code shows all the IPs of all computers in a local network?
// For Win32. link with wsock32.lib :
WSAData wsa1;
if (WSAStartup(MAKEWORD(1, 1), &wsa1) != 0)
return -1;

char shostname[255];
int e;
e=gethostname(shostname, sizeof(shostname));
if (e != 0) {
e= WSAGetLastError ();
return -1;
struct hostent *phost = gethostbyname(shostname);
if (phost == 0)
return -1;
for (int i = 0; phost->h_addr_list[i] != 0; ++i) {
struct in_addr addr;
memcpy(&addr, phost->h_addr_list[i], sizeof(struct in_addr));
//ip address is inet_ntoa(addr)
char oip[50];
If the answer is no, So what can I do?
When I test some codes they only gave me the Ips of computers that were
configured with Network Setup Wizard.
Please Help me!
GeneralRe: Please help me! PinmemberEran Aharonovich30-Mar-05 6:32 
QuestionAnd the environment is? Pinmemberabica1-Mar-05 4:42 
AnswerRe: And the environment is? PinmemberEran Aharonovich25-Jul-05 1:07 
QuestionHow top begin writing a packet sniffer? Pinmembergrace4raghu227-Dec-04 4:42 
GeneralFeeto Pinsussfeeto27-Dec-04 3:46 
GeneralRe: Feeto PinsussAnonymous27-Dec-04 4:45 
GeneralHi PinmemberSanjit Rath1-Nov-04 4:21 
GeneralRe: Hi PinmemberEran Aharonovich25-Jul-05 1:22 
GeneralThe article Location Pinmembersergeyv20028-Sep-04 10:26 
GeneralRe: The article Location PinmemberEran Aharonovich30-Mar-05 6:33 
GeneralNice sniffer.. but.. PinmemberMichael Hendrickx21-Aug-04 3:49 
GeneralRe: Nice sniffer.. but.. PinmemberEran Aharonovich21-Aug-04 7:43 
GeneralRe: Nice sniffer.. but.. PinmemberMichael Hendrickx21-Aug-04 20:37 
GeneralRe: Nice sniffer.. but.. PinmemberThatsAlok10-Nov-04 22:51 
GeneralRe: Nice sniffer.. but.. PinmemberEran Aharonovich14-Nov-04 1:21 
GeneralRe: Nice sniffer.. but.. PinmemberThatsAlok14-Nov-04 18:28 
GeneralRe: Nice sniffer.. but.. PinmemberEran Aharonovich14-Nov-04 20:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.141015.1 | Last Updated 20 Jul 2004
Article Copyright 2004 by Eran Aharonovich
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid