IPPacket Event
Fired whenever a packet is received.
Syntax
public event OnIPPacketHandler OnIPPacket; public delegate void OnIPPacketHandler(object sender, IpmonitorIPPacketEventArgs e); public class IpmonitorIPPacketEventArgs : EventArgs { public string SourceAddress { get; } public int SourcePort { get; } public string DestinationAddress { get; } public int DestinationPort { get; } public int IPVersion { get; } public int TOS { get; } public int Id { get; } public int Flags { get; } public int Offset { get; } public int TTL { get; } public int Checksum { get; } public int IPProtocol { get; } public string Payload { get; }
public byte[] PayloadB { get; } public long Timestamp { get; } }
Public Event OnIPPacket As OnIPPacketHandler Public Delegate Sub OnIPPacketHandler(sender As Object, e As IpmonitorIPPacketEventArgs) Public Class IpmonitorIPPacketEventArgs Inherits EventArgs Public ReadOnly Property SourceAddress As String Public ReadOnly Property SourcePort As Integer Public ReadOnly Property DestinationAddress As String Public ReadOnly Property DestinationPort As Integer Public ReadOnly Property IPVersion As Integer Public ReadOnly Property TOS As Integer Public ReadOnly Property Id As Integer Public ReadOnly Property Flags As Integer Public ReadOnly Property Offset As Integer Public ReadOnly Property TTL As Integer Public ReadOnly Property Checksum As Integer Public ReadOnly Property IPProtocol As Integer Public ReadOnly Property Payload As String
Public ReadOnly Property PayloadB As Byte() Public ReadOnly Property Timestamp As Long End Class
Remarks
When Active is True or ParsePcapFile is called, the component will listen for network traffic or parse the provided file, respectively. For each packet sent across the interface in LocalHost, the component will parse the packet and fire an IPPacket event with the header fields and payload. The parameters are defined as follows:
SourceAddress | The IP address of the originating host in IP dotted format. |
DestinationAddress | The IP address of the destination host in IP dotted format. |
IPVersion | The IP protocol version being used by this packet. |
TOS | The type of service being used by this packet. |
Id | The packet id used to identify and track packets. |
Flags | Flags relating to the status of the packet and desired responses. |
Offset | The fragment offset of this packet in relation to larger data. |
TTL | The time to live for this packet. |
IPProtocol | The IP protocol used in the payload. |
Payload | The data field of the IP packet. This field may contain extra IP headers, depending upon the IP protocol used to create it. |
Timestamp | This is the number of microseconds from the UNIX Epoch (1977-01-01). This is only available when parsing files. |
TOS
Bit 0, 1, 2 | Precedence (see below) |
Bit 3 | Delay (0 = Normal, 1 = Low) |
Bit 4 | Throughput (0 = Normal, 1 = High) |
Bit 5 | Reliability (0 = Normal, 1 = High) |
Precedence
000 | Routine |
001 | Priority |
010 | Immediate |
011 | Flash |
100 | Flash Override |
101 | CRITIC/ECP |
110 | Internetwork Control |
111 | Network Control |
Flags
Bit 0 | Always zero |
Bit 1 | Don't Fragment (0 = May Fragment, 1 = Don't Fragment) |
Bit 2 | More Fragments (0 = Last Fragment, 1 = More Fragments) |
IPProtocol - for a full list, visit www.iana.org.
1 | ICMP |
2 | IGMP |
4 | IP |
6 | TCP |
17 | UDP |