Thread: How to detect connections of an executing app?

  1. #1
    INSANE INSIDE ekosix's Avatar
    Join Date
    May 2010
    Location
    Rio de Janeiro, Brazil
    Posts
    44

    Question How to detect connections of an executing app?

    Hi guys,

    I need to test some tasks for myself and one of them is this:

    - the app's .exe name is pre-coded
    - my code checks if it's running... if NOT try again
    - if yes, retrieve a list of all connections (source and target) including ports

    It would be a console app, I just want it to show each connection from that process.
    minding: source and target, including ports

    Thanks a lot!

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Ok... what OS, which language... what have you tried already... (posting code would be good)

  3. #3
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    [QUOTE=CommonTater;1039048]Ok... what OS....QUOTE]

    No, no, no, no. He wants to make a standard c program, that way it can be portable.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    If the OS gives me full freedom to use the "in" and "out" instructions, using x86, I could do it in an OS portable way...

    EDIT: Ops, I thought he meant hardware ports!
    Devoted my life to programming...

  5. #5
    INSANE INSIDE ekosix's Avatar
    Join Date
    May 2010
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    sorry not to explain very well...
    My app has another app as a target. When the terget is executing, my app would check any internet connection from the target.
    I don't know HOW to make my app "see" those connections with details, like IP addresses and ports.
    Windows OS of course (that's why I posted here).

    _
    when I say "detailed" info, i mean something like "netstat -n"
    Last edited by ekosix; 07-13-2011 at 06:10 PM.

  6. #6
    INSANE INSIDE ekosix's Avatar
    Join Date
    May 2010
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    anyone?

  7. #7
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Have a look at the ipstat sample from the windows sdk.

  8. #8
    INSANE INSIDE ekosix's Avatar
    Join Date
    May 2010
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    wasn't sooooooo helpful but that's ok, thanks...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using/Learning DTL for my DB connections
    By csonx_p in forum C++ Programming
    Replies: 2
    Last Post: 10-08-2008, 11:23 PM
  2. Replies: 40
    Last Post: 09-01-2006, 12:09 AM
  3. Telnet connections
    By b00l34n in forum Networking/Device Communication
    Replies: 2
    Last Post: 11-29-2004, 10:29 AM
  4. net connections
    By sargas99 in forum C++ Programming
    Replies: 3
    Last Post: 09-11-2002, 06:14 PM
  5. Microcontroller Connections
    By gnu-ehacks in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-19-2001, 03:09 AM

Tags for this Thread