Thread: Detecting Connections

  1. #1
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532

    Detecting Connections

    I was wondering... on a Windows box, how could you, in C++ detect what that box was connected to. For example, the netstat command. That lists all the computer's current connections. How would I read all the current connections into my program? I mean, I guess I could query netstat and parse through that but that seems awful inefficient and excessive. I'm looking to make a program, that when it detects a connection to a certain IP address, it closes this connection. Any help would be appreciated.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Have a look at GetTcpTable and maybe GetUdpTable.

  3. #3
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Why thank you! This looks just like what I need. Thanks.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Persistent connections
    By Niara in forum Networking/Device Communication
    Replies: 6
    Last Post: 09-25-2007, 05:27 AM
  2. Select handling more then 500 connections
    By Chronom1 in forum Networking/Device Communication
    Replies: 5
    Last Post: 02-27-2005, 03:20 PM
  3. Detecting WinSock Connections
    By tyouk in forum Networking/Device Communication
    Replies: 8
    Last Post: 07-31-2004, 01:24 PM
  4. WinXP Network Connections pop-up
    By DavidP in forum Tech Board
    Replies: 1
    Last Post: 10-02-2002, 05:36 PM
  5. Multiple Client Connections
    By (TNT) in forum Windows Programming
    Replies: 1
    Last Post: 04-06-2002, 11:04 PM