Never mind, I found the answer. I came across the source code for netstat, which is what I want to display. If anyone comes across this problem, please look at Iphlpapi for functions available from there, I am using GetTcpTable.