.Net frameworks 2.0 have new addition of Namespace, System.Net.NetworkInformation, it provide a number of interesting classes to extract the network related statistics and state of the machine, it pretty much provide most of the functionality which is exposed by native IPHelper APIs.
Earlier I had shown a simple example for getting network availbility event notification. Here is another simple 4 line example, where your application could check all the listening ports on the machine.
public class Test
public static void
IPGlobalProperties ipGlobal = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint connections = ipGlobal.GetActiveTcpListeners ( ) ;
foreach(IPEndPoint ipe in connections)
Console.WriteLine("Listening IPEndPoint = "+ipe.Port);