c++ - How to get number of connections on PORT per IP in Windows? -
i have been searching around google time , can`t seem find answer... i using getextendedtcptable() view current connections, unable number of connections each ip on specific port. is there example/function ? or have create ? any guidance or example appreciated. have nice day! so using this code msdn basis end example enumerates list of connections, populating pointer int ports number of connections remote systems local ports. to determine number of connections particular local port, can print out value of ports[port] . the code supplied more c , c++ , used new[] , delete[] ports. #include <winsock2.h> #include <ws2tcpip.h> #include <iphlpapi.h> #include <stdio.h> #pragma comment(lib, "iphlpapi.lib") #pragma comment(lib, "ws2_32.lib") #define malloc(x) calloc(1, (x)) #define free(x) free((x)) int main() { // declare , initialize variables pmib_tcptable_owner_pid ptcptable; int *ports; // array of ...