The opinions expressed herein are my own personal opinions. They are not necessarily fact or sactioned by any other person or organization. If you disagree that's your right. It's also my right to not care.
© Copyright 2010, Chris Tacke
Need to view or update the Netowrk Routing Table on your CE/ WinMo device? Smart Device Framework 2.2's updated NetworkInformation namespace adds a whole lot of new classes, including a full set of classes for routing table access. Here's a quick example of displaying the current routes:
IPRoutingTable table = IPRoutingTable.GetRoutingTable();Debug.WriteLine("\r\n*IP Routing Table\r\n====================");Debug.WriteLine(string.Format("{0}{1}{2}{3}{4}", "[Interface]".PadRight(16), "[Type]".PadRight(12), "[Destination]".PadLeft(17), "[NetMask]".PadLeft(17), "[Next Hop]".PadLeft(17)));foreach (IPForwardEntry entry in table){ string intfname = entry.NetworkInterface == null ? intfname = "{Loopback}" : entry.NetworkInterface.Name; Debug.WriteLine(string.Format("{0}{1}{2}{3}{4}", intfname.PadRight(16), entry.RouteType.ToString().PadRight(12), entry.Destination.ToString().PadLeft(17), entry.SubnetMask.ToString().PadLeft(17), entry.NextHop.ToString().PadLeft(17)));}
Can't be much simpler than that.
Remember Me