Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Event to capture IP Packets

Event to capture IP Packets

Scheduled Pinned Locked Moved C#
helpsysadmintutorial
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Activwerx inc
    wrote on last edited by
    #1

    I am writing an application which captures IP packets from the default network interface. The original code uses hard coded data which does not allow it to be used by other programmers. I am attempting to rewrite the code to use an event which should be triggered every time a packet arrives however i am STUCK! The packet capture method, called Capture() stores each packet in a class called IPPacket I have a delegate declared as public delegate void PacketArrival(object sender, IPPacket packet); and an even declared as public event PacketArrival OnPacketArrival; I do not know how to link the Capture() method to the delegate so that when the event is used, the capture method will notify the event each time a packet arrives Please help!!!

    A 1 Reply Last reply
    0
    • A Activwerx inc

      I am writing an application which captures IP packets from the default network interface. The original code uses hard coded data which does not allow it to be used by other programmers. I am attempting to rewrite the code to use an event which should be triggered every time a packet arrives however i am STUCK! The packet capture method, called Capture() stores each packet in a class called IPPacket I have a delegate declared as public delegate void PacketArrival(object sender, IPPacket packet); and an even declared as public event PacketArrival OnPacketArrival; I do not know how to link the Capture() method to the delegate so that when the event is used, the capture method will notify the event each time a packet arrives Please help!!!

      A Offline
      A Offline
      Activwerx inc
      wrote on last edited by
      #2

      I've worked it out! :-) all working. The Capture() method captures a packet and fires an event. All event listeners are able to recieve the captured packet and perform some action on it.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups