K
Kemo
Hi ppl.
I'm trying to write a sniffer. I can trace all incoming datagrams but no
outgoing. I don't know how to. Can anyone help on this? Here is a sample
code in C#.
_MainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw,
ProtocolType.IP);
_MainSocket.Bind(new IPEndPoint(address, 0));
_MainSocket.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.HeaderIncluded, true);
_MainSocket.IOControl(IOControlCode.ReceiveAll, new byte[4] { 1, 0, 0, 0 },
new byte[4] { 0, 0, 0, 0 });
_ByteData = new byte[_PacketSize];
_Enabled = true;
_MainSocket.BeginReceive(_ByteData, 0, _ByteData.Length, SocketFlags.None,
new AsyncCallback(OnPacketRecive), null);
Thanks
I'm trying to write a sniffer. I can trace all incoming datagrams but no
outgoing. I don't know how to. Can anyone help on this? Here is a sample
code in C#.
_MainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw,
ProtocolType.IP);
_MainSocket.Bind(new IPEndPoint(address, 0));
_MainSocket.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.HeaderIncluded, true);
_MainSocket.IOControl(IOControlCode.ReceiveAll, new byte[4] { 1, 0, 0, 0 },
new byte[4] { 0, 0, 0, 0 });
_ByteData = new byte[_PacketSize];
_Enabled = true;
_MainSocket.BeginReceive(_ByteData, 0, _ByteData.Length, SocketFlags.None,
new AsyncCallback(OnPacketRecive), null);
Thanks