473,472 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Sniffing UDP Packets

Below I have some code. That code works fine on a LAN but when I move
to Wireless Devices or other dial-up connections I get only the
received packets and not the sent packets.

Is there any bug in the code below?

Thank you,
Nuno Magalhaes

---------------------------------
public void Run()
{
int len_receive_buf=4096;
int len_send_buf=4096;
byte[] receive_buf=new byte[len_receive_buf];
byte[] send_buf=new byte[len_send_buf];
int cout_receive_bytes;
Socket socket=new
Socket(AddressFamily.InterNetwork,SocketType.Raw,P rotocolType.IP);
socket.Blocking=false;
socket.Bind(new IPEndPoint(IPAddress.Parse(DefaultIPComboBox.Text) ,0));
socket.SetSocketOption(SocketOptionLevel.IP,Socket OptionName.HeaderIncluded,1);
byte[] IN=new byte[4]{1,0,0,0};
byte[] OUT=new byte[4];
int SIO_RCVALL=unchecked((int)0x98000001);
int ret_code=socket.IOControl(SIO_RCVALL,IN,OUT);
while(true)
{
IAsyncResult
ar=socket.BeginReceive(receive_buf,0,len_receive_b uf,SocketFlags.None,null,this);
cout_receive_bytes=socket.EndReceive(ar);
Receive(receive_buf);
}
}

Nov 17 '05 #1
0 1143

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: James | last post by:
I wasn't sure where to post this so I'm sorry if this is the wrong place. But I would like to know what some of the differences are between client-side and server-side browser sniffing. I'm aware...
0
by: Nuno Magalhaes | last post by:
Why does C# only supports LAN packet sniffing? Should I have to use WinPCap if I want to capture the outgoing packets on xp pro also? Why this limitation? Here's the source for capturing the...
0
by: shoi | last post by:
Hi, I am a newer to this field. I am writing the codes to sniff packets sent out by routers. The sample provided in Code Project seems not able to capture any multicasting packets? Is it possible to...
3
by: T00l | last post by:
Hi All I have found the simple script that sniffs ICMP packets using Impacket and pcapy. At the moment it is capturing the packet header and data, I was just wondering if anyone knows a way to get...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.