[Sample Of Apr 28th] How to list active network endpoints on the system (TCP & UDP - IPv4)

 

Homepage image
RSS Feed

Sample Download : https://code.msdn.microsoft.com/How-to-list-active-network-daf8ff48

This sample shows the TCP and UDP endpoints on the current system. This sample only covers IPv4 endpoints.

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

Sample output -

 Number of TCP end points (IPv4) - 38

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

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

.
.
.

 Number of UDP end points (IPv4)- 61

 PID            LocalAddr       LocalPort
 ===            =========       ==========
 1100            0.0.0.0        123
 1144            0.0.0.0        500
 1352            0.0.0.0        3702
 4896            0.0.0.0        3702
 1352            0.0.0.0        3702
 4896            0.0.0.0        3702
 1144            0.0.0.0        4500
 1228            0.0.0.0        5355
 1352            0.0.0.0        54225 

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 https://1code.codeplex.com/.