PacketDirection direction = PacketDirection.Inbound; if (direction == PacketDirection.Inbound) { Console.WriteLine("Packet is incoming."); } else { Console.WriteLine("Packet is outgoing."); }
PacketDirection direction = PacketDirection.Outbound; if (direction == PacketDirection.Inbound) { Console.WriteLine("Packet is incoming."); } else { Console.WriteLine("Packet is outgoing."); }In this example, we create a new PacketDirection variable called "direction" and set its value to Outbound. We then use an if statement to check if the direction is inbound, and since it is not, we print out a message indicating that the packet is outgoing. Package library: System.Net.Sockets