Re: COmpact Framework Network Sniffing

Tech-Archive recommends: Fix windows errors by optimizing your registry



You aren't going to be able to do that. At most, you'll be able to display
the UI with a Compact Framework application. You'll have to completely
rewrite the actual sniffing code to work with the Windows CE network stack
and that's very likely to involve writing an intermediate driver (native
code) to capture the packets and forward them, via a point-to-point message
queue, maybe, to the waiting UI program.

Paul T.

<Graville@xxxxxxxxx> wrote in message
news:1174558685.829863.59920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,

I am having a problem writing a a simpe IP packet sniffer for Windows
Mobile 5. I have taken a simple piece of code that works fine on the
standard framework but when I run under CF 2.0 I get compilation
errors in relation to the IOControlCode enum which the compact
framework does not recognise. I get an error "The name 'IOControlCode'
does not exist in the current context" I'm assuming raw socket
capturing is supported in CF 2.0. Does anyone know what the enum value
should be as CF expects an int but i tried the int -1744830463 which i
found on the MSDN website but this fails.

//For sniffing the socket to capture the packets has to be a raw
socket, with the
//address family being of type internetwork, and protocol being IP
mainSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Raw, ProtocolType.IP);

//Bind the socket to the selected IP address
mainSocket.Bind(new IPEndPoint(IPAddress.Parse(cmbInterfaces.Text),
0));

//Set the socket options
mainSocket.SetSocketOption(SocketOptionLevel.IP, //Applies
only to IP packets
SocketOptionName.HeaderIncluded, //
Set the include the header
true); //
option to true

byte[] byTrue = new byte[4] { 1, 0, 0, 0 };
byte[] byOut = new byte[4];

//Socket.IOControl is analogous to the WSAIoctl method of Winsock 2
mainSocket.IOControl(IOControlCode.ReceiveAll, //THIS LINE
FAILS
byTrue,
byOut);

//Start receiving the packets asynchronously
mainSocket.BeginReceive(byteData, 0, byteData.Length,
SocketFlags.None,
new AsyncCallback(OnReceive), null);


Hope you can help,

Dave Hanson



.



Relevant Pages

  • Re: COmpact Framework Network Sniffing
    ... the UI with a Compact Framework application. ... does not exist in the current context" I'm assuming raw socket ... found on the MSDN website but this fails. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: COmpact Framework Network Sniffing
    ... the UI with a Compact Framework application. ... does not exist in the current context" I'm assuming raw socket ... found on the MSDN website but this fails. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: COmpact Framework Network Sniffing
    ... The OS doesn't support doing what you ... so what the framework allows is irrelevant. ... basics of what you'll have to do to capture packets (driver/application ... does not exist in the current context" I'm assuming raw socket ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Problem with writing fast UDP server
    ... UDP packets per second. ... socket and threads. ... I wrote a simple case test: client and server. ... The maximum theoretical limit is 14,880 frames per ...
    (comp.lang.python)
  • RE: *warning* student question
    ... What option is this supposed CRC or hash supposed to be? ... >their shell session you're taking over their network socket. ... Systems will also drop TCP packets with bad checksums. ... We provide Ethical Hacking, Advanced Ethical Hacking, Intrusion ...
    (Security-Basics)