Listing current connections

This is a discussion on Listing current connections within the Networking/Device Communication forums, part of the General Programming Boards category; Hello, I'm trying to make a program that will list all tcp/udp connections. I can get the actuall connections using ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    24

    Listing current connections

    Hello, I'm trying to make a program that will list all tcp/udp connections. I can get the actuall connections using GetTcpTable, GetUdpTable but how can I get the process that is associated with that connection?

    thank you

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    What OS?
    Also, whats the point, netstat already does this?
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    24
    windows xp, The reason I want to do this is I think it will be a usefull feature in my program.
    Also, I did not ask how to get the connections, I asked how to get the process associated with that particular connection. I know this is possible because I have seen it done in other programs. 'active ports' for example.
    I realise I named the topic wrong, sorry.

    thanks

  4. #4
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    For windows the netstat option is -b to show what programs PID its associated with. As for how its implemented, I am unsure. I would bet their is a system call or something that gets information on what filedescriptors/sockets a program has open. I have no idea beyond that, all I can think of is to search through MSDN to see if they have any info on that posted. Ill let any one else with an idea post now.
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    24
    I did manage to find something that does what I want, GetExtendedTcpTable, but it only works on xp sp2, and I want it to work on 98 - xp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Immediate programming help! Please!
    By xMEGANx in forum C++ Programming
    Replies: 6
    Last Post: 02-20-2008, 11:52 AM
  2. Problem with simple case statements
    By shoobsie in forum C Programming
    Replies: 2
    Last Post: 05-08-2006, 08:39 AM
  3. compiler build error
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-30-2003, 09:16 AM
  4. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM
  5. HelpMePlease
    By Prncess100 in forum C++ Programming
    Replies: 6
    Last Post: 12-11-2002, 01:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21