I am interested in gathering some statistics from every TCP connection on a windows box for performance evaluation reasons. I see part of the API I need:
"The GetTcpTable2 function retrieves the IPv4 TCP connection table."
I could obviously poll this function to find new connections, but really what I would like to do is collect some statistics at the end of each connection. In other words right before or upon the transition to the MIB_TCP_STATE_DELETE_TCB state.
Is there a way to hook into the windows internals or subscribe to an event notification mechanism so I can avoid polling? (I do know about Windows Filtering Platform but it doesn't look like that gives me exactly what I want.)
Alternative suggestions would also be appreciated!