CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2010
    Posts
    5

    Java programmer new to C#/using C# and Win32API

    Hi guys, im a newbie to C# having programmed with Java a fair amount.

    Im currently writing my own (amateur) intrusion detection system and the reason i haven't done this in Java is that a friend told me it would be easier to access the OS using C#.

    I was wondering if you guys could give me a few basics how to do something like check a port using the win32API in C# and I could use that as an example and go from there.

    I have tried finding books on the subject, but only found a MSPress C/C++ on the api

    Thanks in advance

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Java programmer new to C#/using C# and Win32API

    Not sure what you mean exactly when you say "check a port". Are you referring to serial port communications, TCP/IP, etc? Here is a tutorial on serial port communication in C#, you probably do not need to use the Win32 API directly at all.

    http://www.dreamincode.net/forums/showtopic35775.htm

  3. #3
    Join Date
    Jan 2010
    Posts
    5

    Re: Java programmer new to C#/using C# and Win32API

    Quote Originally Posted by BigEd781 View Post
    Not sure what you mean exactly when you say "check a port". Are you referring to serial port communications, TCP/IP, etc? Here is a tutorial on serial port communication in C#, you probably do not need to use the Win32 API directly at all.

    http://www.dreamincode.net/forums/showtopic35775.htm
    Hey, basically ive been told say i want to monitor a port which is letting msn messenger traffic through, i would not be able to connect to that port via C# because 'msn messenger' would have rights over the port and c# would find that port is 'unavailable'.

    So a friend of mine suggesed that i would need to go a level down, to the OS in order to monitor TCP and UDP ports.

    In addition, i was hoping to monitor registry changes for particular keys etc.

    Hope this clarifies?

  4. #4
    Join Date
    Jan 2010
    Posts
    5

    Re: Java programmer new to C#/using C# and Win32API

    bump

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Java programmer new to C#/using C# and Win32API


  6. #6
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Java programmer new to C#/using C# and Win32API

    I think this is what you're looking for .NET WinPCap
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  7. #7
    Join Date
    Jan 2010
    Posts
    5

    Re: Java programmer new to C#/using C# and Win32API

    Quote Originally Posted by memeloo View Post
    I think this is what you're looking for .NET WinPCap

    http://pcapdotnet.codeplex.com/

    Would someone be able to give me some advice how i actually get this 'wrapper' stuff set up?

    I'm not the world's best when it comes to libraries. Ive got VS2008 Pro installed, so i have access to all .NET methods.

  8. #8
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Java programmer new to C#/using C# and Win32API

    I suggest starting with the tutorial:

    Pcap.Net tutorial: a step by step guide to using Pcap.Net.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured