Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

Capture ethernet frames

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Erik Tamminga - 02 Jul 2005 11:33 GMT
Hi,

Is there any way of captureing ethernet frames (not only IP, I know how to
do that) using the .NET framework?

Especially, I'm trying to listen to Cisco CDP traffic present on the wire.
The traffic is non-ip using a special destination mac-address and
ethernet-type.

Regards,

Erik Tamminga
Lloyd Dupont - 02 Jul 2005 14:43 GMT
I'm sure that in the owrst case scenario you could interop the required
native function

Anyway, I haven't tryed myself but one of the socket constructor has plenty
of argument, including a SocketProtocol...
with a long list:
Ggp, Icmp, Idp, Igmp, IP, IPv4, IPv6, ND, etc....
even Unknow.. (what could this be?)

> Hi,
>
[quoted text clipped - 8 lines]
>
> Erik Tamminga
Erik Tamminga - 03 Jul 2005 17:51 GMT
Hi Lloyd,

Tried them all. All but the IP based give an error creating the socket. So
no hopes on getting this working.

I've found several packet capture drivers that could work from within .net
but I'm hasitating using a packet capture driver which needs to be installed
separately. Besides this, some need administrative permissions to access,
which I cannot use either.

So ....

Erik

> I'm sure that in the owrst case scenario you could interop the required
> native function
[quoted text clipped - 17 lines]
>>
>> Erik Tamminga
Lloyd Dupont - 04 Jul 2005 00:42 GMT
well, it seems to me that the best solution in your case, provided you know
how to write what you want in C, is to use Interop technology.

Interop is the technology which let you declare you C function prototype in
a C# class and then just uses them!
exemple:
//------------ example.cs -----------------
using System.Runtime.InteropServices;
using System.Security;

[SuppressUnmanagedCodeSecurity] // better perf, less security
public class SysFunctions
{
 const string KERNEL32 = "Kernel32";

 [DllImport(KERNEL32, SetLastError = true, CallingConvention =
CallingConvention.Winapi)]
 private static extern IntPtr LoadLibrary(string libname);

 public static void Init()
 {
   if(LoadLibrary("mylib.dll") == IntPtr.Zero)
       throw new InvalidOperationException("can't find mylib");
 }
}
// -------------------

Look for interop in the documentation. (just type 'interop' in the
documentation index, or try google ;)

Alternatively you could write a managed C++ wrapper, if there are heaps of
function / structure to defined.
That would gives you the more power with less work to do (but comes with a
lot of C++ fussyness).
Here is a link about managed C++ 2.0 syntax:
http://msdn2.microsoft.com/library/xey702bw(en-us,vs.80).aspx

// ------ exemple.h ---------
#pragma once

#include <windows.h>

using namespace System;

public ref class SysFunctions
{
   public:
       static void Init()
       {
           HMODULE h = LoadLibrary("mylib.dll");
           if( !h )
               throw gcnew InvalidOperationException("Can't find mylib");
       }
};
// -------------------------

> Hi Lloyd,
>
[quoted text clipped - 31 lines]
>>>
>>> Erik Tamminga
Lloyd Dupont - 04 Jul 2005 00:52 GMT
on purely personal interest level, what is your website about? (I don't
speak dutch, but I do french & australian)
I have some personal interest in cooking + software...
try ld at galador dot net or , dl at ten dot rodalag dot reverse dot this,
hehe...

> Hi Lloyd,
>
[quoted text clipped - 31 lines]
>>>
>>> Erik Tamminga
Erik Tamminga - 06 Jul 2005 21:10 GMT
My website?

> on purely personal interest level, what is your website about? (I don't
> speak dutch, but I do french & australian)
[quoted text clipped - 37 lines]
>>>>
>>>> Erik Tamminga
Lloyd Dupont - 06 Jul 2005 23:47 GMT
> My website?

euh.. yeah: www.tamminga.nl , no?
Erik Tamminga - 09 Jul 2005 20:02 GMT
Nop, Sorry, that's a backery somewhere in the netherlands. I'm not related
to them.

my website is www.etamminga.nl, but doens't have any content. :)

Erik

>> My website?
>
> euh.. yeah: www.tamminga.nl , no?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.