1

How can I get the running processes which established a TCP connection in C++?

I know about Process::GetProcesses() function.

But how can I short list those processes which established a TCP connection.

Any property in Process class describe this.?

  • *"I know about Process::GetProcesses() function."* - perhaps, but we don't - it's not a C++ Standard Library class/function. You should specify *which library* you're using if you want advice on it, since there are doubtless many libraries with a `Process` class or namespace, and might be a few of those with `GetProcesses()` functions.... – Tony Delroy Feb 18 '15 at 05:16
  • I just decided to use MFC ... Is there any classes which can provide me the details.. – Mithun Bhaskar Feb 18 '15 at 05:53

1 Answers1

3

If on windows system you need to use IPhelper apis

GetTcpTable2()

GingerJack
  • 3,044
  • 1
  • 17
  • 19
  • Yes, this should get you process ids for all the processes which have any tcp connections – Ahmad Mushtaq Feb 18 '15 at 06:49
  • yes I tried it.. Actually it gave me all TCP connections and process IDs now I want the Process names of those corresponding PIDs.. That is My requirement – Mithun Bhaskar Feb 18 '15 at 09:15
  • 3
    Did you try this [Process name from process id] (http://stackoverflow.com/questions/4102569/get-process-name-from-process-id-win32/) – GingerJack Feb 18 '15 at 10:08