Homepage image
RSS Feed

Sample Download : http://code.msdn.microsoft.com/CSCheckExeType-aab06100

This sample shows how to list active network endpoints on the system (TCP & UDP - IPv6). This sample only covers IPv6 endpoints.

The sample output is similar to output from netstat (-aon)

Sample output -
 Number of TCP end points (IPv6) - 10

 PID      LocalAddr      LocalPort      RemoteAddr      RemotePort      ConnState
 ===      =========      =========      ==========      ===========     ======

    4                 ::        80                 ::         0     LISTEN
 1004                 ::       135                 ::         0     LISTEN
    4                 ::       445                 ::         0     LISTEN
  668                 ::      1026                 ::         0     LISTEN
 1036                 ::      1027                 ::         0     LISTEN
 1144                 ::      1029                 ::         0     LISTEN
  744                 ::      1030                 ::         0     LISTEN
    4                 ::      5357                 ::         0     LISTEN
    4                 ::     47001                 ::         0     LISTEN
  728                 ::     65166                 ::         0     LISTEN

 Number of UDP end points- 13
PID                     LocalAddr                       LocalPort
===                     =========                       ==========
 1100                             ::                      123
 1144                             ::                      500
 1352                             ::                     3702
 4896                             ::                     3702
 1352                             ::                     3702
 4896                             ::                     3702
 1144                             ::                     4500
 1228                             ::                     5355
 1352                             ::                    54226
 1352                            ::1                     1900
 1352                            ::1                    52017

imageYou can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.