Category Archives: Snippcode

List all tcp connection with PID

#include <winsock2.h> #include <ws2tcpip.h> #include <iphlpapi.h> #include <stdio.h> // Need to link with Iphlpapi.lib and Ws2_32.lib #pragma comment(lib, “iphlpapi.lib”) #pragma comment(lib, “ws2_32.lib”) #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) #define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) /* Note: could also use malloc() and free() */ int main() { // Declare and initialize variables PMIB_TCPTABLE2 pTcpTable; ULONG ulSize = 0; […]

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.