How to Tell If a Program Is Connecting to the Internet: A Complete Practical Guide

How to Tell If a Program Is Connecting to the Internet: A Complete Practical Guide

Your computer is sitting quietly on your desk. You are not browsing the web, downloading files, watching videos, or playing an online game.

Yet somewhere in the background, an application might be communicating with a remote server.

It could be your operating system checking for updates, a browser synchronizing settings, an application verifying its license, a cloud storage client uploading files, or an AI assistant communicating with an external service.

Computer network activity visualization showing applications communicating with local and remote servers
Computer network activity visualization showing applications communicating with local and remote servers

Most of these connections are perfectly legitimate. But how do you know which program is responsible, where it is connecting, and whether that communication is expected?

More importantly, how can you investigate an unfamiliar network connection without accidentally disrupting your computer?

Learning how to tell if a program is connecting to the internet is a useful skill for anyone interested in computer security, privacy, networking, software development, or troubleshooting.

The good news is that you do not need expensive cybersecurity software or advanced technical knowledge to get started.

Windows, Linux and macOS already provide tools that can help you investigate network activity.

In this guide, we will explore how applications communicate, how to identify their network connections, how to interpret the results, and how to investigate unexpected activity.

We will also build a small Python application that monitors newly observed network connections on your own computer.

By the end of this guide, you will have a better understanding of what your computer is communicating with and how to investigate that activity responsibly.

1. Why Do Programs Connect to the Internet?

Modern applications communicate with remote systems for many different reasons.

Some applications cannot function without an internet connection. Others work primarily offline but occasionally communicate with external servers.

Common reasons include:

  • Downloading software updates.
  • Synchronizing files or settings.
  • Checking software licenses.
  • Loading advertisements.
  • Retrieving online content.
  • Sending crash reports.
  • Collecting diagnostic or usage information.
  • Authenticating users.
  • Accessing cloud storage.
  • Communicating with online APIs.
  • Downloading AI models.
  • Connecting to multiplayer gaming services.

For example, a text editor may check for updates even when you are editing a local document.

A gaming application might maintain a connection to its authentication service while you are not actively playing.

A local AI application may perform model inference on your computer while still communicating with external services for model downloads, updates, or optional features.

An internet connection does not automatically indicate malicious activity.

The important question is whether the connection makes sense for the application and the way you are using it.

2. Does Connecting to the Internet Mean a Program Is Sending My Data?

Not necessarily.

A network connection establishes a communication path between endpoints. It does not, by itself, tell you exactly what information has been exchanged.

Consider these three situations.

An application checks for updates

The program may contact a server to retrieve information about the latest available version.

An application synchronizes files

The program may transfer documents, photographs, settings or other user information.

An application maintains an idle connection

The program may keep a connection open so it can receive future notifications without repeatedly reconnecting.

From a basic network connection listing, these situations may look similar.

You might see the application name, a remote IP address, a port number and a connection state.

However, determining the actual purpose or contents of the communication requires additional evidence.

This is an important distinction:

A network connection is an observation. Its purpose is an interpretation.

Avoid drawing conclusions before collecting enough information.

3. Understanding How Programs Communicate

Before investigating network activity, it helps to understand a few fundamental networking concepts.

Imagine opening a website in your browser.

Your computer communicates with a remote server, exchanges information and receives the content needed to display the page.

A simplified connection might look like this:

Your web browser
       |
       v
Your computer
192.168.1.20:51432
       |
       v
Router / Network
       |
       v
Remote web server
203.0.113.10:443

The addresses in this example are illustrative. The remote address belongs to a range reserved for documentation.

Several pieces of information are involved.

Local IP address

The local IP address identifies the network interface your computer is using for the connection.

Examples include:

  • 127.0.0.1 — IPv4 loopback.
  • 192.168.1.20 — an example private IPv4 address.
  • An IPv6 address assigned to your computer.

Local port

The local port identifies the communication endpoint on your computer.

For outgoing connections, the operating system frequently assigns a temporary local port.

Remote IP address

The remote IP address identifies the other endpoint involved in the communication.

It might belong to a computer on your local network, a cloud provider, a website, or another remote system.

Remote port

The remote port helps identify the communication endpoint on the remote system.

Common examples include:

Port Common use
53 DNS
80 HTTP
443 HTTPS and other encrypted services
22 SSH
25 SMTP email transfer
123 Network Time Protocol
3389 Remote Desktop Protocol

Some services use TCP, others use UDP, and some support both.

Port numbers provide useful clues, but they do not guarantee the identity or purpose of the application protocol.

For example, port 443 is commonly used for HTTPS, but other types of communication can also use it.

4. TCP vs. UDP: Why You Should Understand Both

Many network-monitoring tutorials focus primarily on TCP connections.

However, modern applications also use UDP extensively.

TCP

Transmission Control Protocol provides a connection-oriented communication mechanism.

TCP includes features such as reliable delivery, ordering and retransmission.

Common applications include web browsing, file transfers, email and many application APIs.

UDP

User Datagram Protocol provides a simpler communication mechanism without TCP’s connection establishment and reliability guarantees.

It is commonly used for DNS, gaming, streaming, voice communication and other applications.

Modern HTTP/3 communication uses QUIC, which operates over UDP.

This matters because a browser may be actively communicating with a website without producing the TCP connection you expected to see.

Feature TCP UDP
Connection-oriented transport Yes No
Built-in retransmission Yes No
Ordered delivery Yes No
Commonly used by HTTPS Yes Through QUIC for HTTP/3
Easy to inspect through established TCP listings Yes No

An investigation limited to established TCP connections can miss important network activity.

Throughout this guide, we will identify where particular tools provide TCP-only information and where additional monitoring may be necessary.

5. Local Connections vs. Internet Connections

Not every network connection leaves your computer.

Programs can use networking interfaces to communicate with other applications running locally.

Loopback connections

An application connecting to:

127.0.0.1:1234

is communicating through the local IPv4 loopback interface.

The IPv6 equivalent is:

::1

This is common with development servers, database applications and local AI inference engines.

A Python AI agent might communicate with LM Studio through a loopback connection without directly accessing the public internet.

However, the application receiving that local request may separately communicate with external services.

Private network connections

An application connecting to:

192.168.1.50:8080

may be communicating with another device on a private network.

Examples include:

  • A home media server.
  • A network printer.
  • A network-attached storage device.
  • A dedicated AI workstation.
  • An internal company application.

Private addresses are also used in virtual networks and VPN environments, so they do not always represent physically nearby devices.

Global IP addresses

Connections to globally routable IP addresses often deserve closer examination when investigating internet activity.

However, even a globally routable destination does not prove that traffic traveled through the public internet. Routing policies, internal infrastructure, VPNs and other network arrangements can affect the actual path.

A useful first distinction is:

Destination What it suggests
Loopback Communication within the local computer
Private address Communication within a private or virtual network
Link-local address Communication within a local network segment
Globally routable address Potential communication beyond the local environment

These are classifications, not security verdicts.

6. What Do Network Connection States Mean?

When examining TCP connections, you may encounter several connection states.

State General meaning
LISTENING / LISTEN An application is waiting for incoming connections
ESTABLISHED A TCP connection has been established
SYN_SENT A connection attempt is in progress
SYN_RECEIVED A connection request has been received and is being established
CLOSE_WAIT The remote endpoint has initiated closure
TIME_WAIT TCP is retaining connection state temporarily after closure
FIN_WAIT The connection is in a closing phase

Two states are especially useful for beginners.

LISTENING

A listening application is waiting for connections.

This does not necessarily mean that someone is connected to it, or that it is accessible from the internet.

ESTABLISHED

An established connection indicates that TCP communication has been successfully established between two endpoints.

However, it does not necessarily mean the application is actively transferring information at that exact moment.

It also does not independently tell you which endpoint originally initiated the connection.

Understanding these distinctions can prevent unnecessary confusion when reviewing network activity.

7. How to Check Which Programs Are Connecting to the Internet on Windows

Windows includes several tools that can help you identify network activity.

Let’s start with the easiest options.

Method 1: Windows Resource Monitor

Resource Monitor is a useful starting point because it provides a graphical interface.

Press Win + R, enter:

resmon

and press Enter.

Select the Network tab.

Depending on the Windows version and current activity, you may see sections such as:

  • Processes with Network Activity.
  • Network Activity.
  • TCP Connections.
  • Listening Ports.

The Processes with Network Activity section can help you identify applications sending or receiving information.

You may also see information about the amount of data being transferred.

This is particularly useful if you want to investigate:

  • Unexpected background downloads.
  • Slow internet performance.
  • Applications using significant bandwidth.
  • Network activity while your computer appears idle.

You can select a particular process to focus on its associated activity.

For many users, Resource Monitor is an excellent first step because no additional software is required.

Method 2: Using netstat

The netstat command provides information about network connections through a command-line interface.

Open Command Prompt and run:

netstat -ano

The parameters have the following purposes:

  • -a displays active connections and listening endpoints.
  • -n displays numeric addresses and port numbers.
  • -o includes the associated process ID.

An illustrative result might look like this:

Proto  Local Address        Foreign Address      State        PID

TCP    192.168.1.20:51432    203.0.113.10:443     ESTABLISHED  7420
TCP    127.0.0.1:55012       127.0.0.1:1234       ESTABLISHED  9184
TCP    0.0.0.0:8080          0.0.0.0:0            LISTENING    6228

The final column contains the process ID, commonly called PID.

To identify the first process, run:

tasklist /FI "PID eq 7420"

Replace 7420 with the actual PID from your computer.

You can also use:

netstat -abno

The additional -b option attempts to display the executable involved in each connection.

This may require administrator privileges and can take longer to complete.

Method 3: Using PowerShell

PowerShell provides structured access to Windows networking information.

Open PowerShell and run:

Get-NetTCPConnection -State Established

To display the owning process alongside the connection:

Get-NetTCPConnection -State Established |
    Select-Object LocalAddress,
                  LocalPort,
                  RemoteAddress,
                  RemotePort,
                  OwningProcess,
                  @{
                      Name = "ProcessName"
                      Expression = {
                          (
                              Get-Process `
                                  -Id $_.OwningProcess `
                                  -ErrorAction SilentlyContinue
                          ).ProcessName
                      }
                  } |
    Format-Table -AutoSize

This provides a more readable overview of active TCP connections and their associated applications.

Some process names may be unavailable because a process has exited or because the current account lacks the necessary permissions.

Monitor a specific program

Suppose you want to investigate your browser.

For example:

$processIds = @(
    Get-Process -Name "chrome" `
        -ErrorAction SilentlyContinue |
    Select-Object -ExpandProperty Id
)

if ($processIds.Count -gt 0) {
    Get-NetTCPConnection -State Established |
        Where-Object {
            $_.OwningProcess -in $processIds
        } |
        Select-Object LocalAddress,
                      LocalPort,
                      RemoteAddress,
                      RemotePort,
                      OwningProcess
}
else {
    Write-Host "No matching processes were found."
}

Replace chrome with the process name you want to investigate.

Keep in mind that modern applications frequently use several processes, and some network communication may be performed by separate helper applications or operating system services.

What about UDP on Windows?

You can inspect local UDP endpoints using:

Get-NetUDPEndpoint |
    Select-Object LocalAddress,
                  LocalPort,
                  OwningProcess

Unlike an established TCP connection listing, this does not generally provide a complete history of remote UDP destinations.

For detailed UDP activity, packet capture or appropriate event-based monitoring may be necessary.

8. Using Microsoft TCPView to Monitor Applications

If you prefer a dedicated graphical networking utility, Microsoft’s TCPView is worth exploring.

TCPView is part of the Sysinternals collection of Windows diagnostic tools.

You can download it from the official Microsoft website:

Download Microsoft TCPView

TCPView can display information such as:

  • Process names.
  • Process IDs.
  • TCP and UDP endpoints.
  • Local addresses and ports.
  • Remote addresses and ports, when available.
  • TCP connection states.

It updates its display as network endpoints appear and disappear.

This makes it useful when investigating applications that establish temporary connections.

A simple TCPView experiment

  1. Open TCPView.
  2. Observe the currently visible connections.
  3. Start your web browser.
  4. Open a website you trust.
  5. Observe the new connections.
  6. Close the browser.
  7. Watch how the connection listing changes.

You may notice that browser connections do not always disappear immediately.

Processes can remain active temporarily, extensions may continue working, and TCP connection states may persist after communication ends.

This simple experiment helps you understand the relationship between applications and network activity.

TCPView also offers operations that can close connections. For an initial investigation, use it as an observation tool rather than interrupting unfamiliar connections.

9. How to Check Program Network Connections on Linux

Linux provides several powerful tools for investigating networking activity.

Using ss

Open a terminal and run:

ss -tunap

The options generally mean:

  • -t — TCP sockets.
  • -u — UDP sockets.
  • -n — numeric addresses and ports.
  • -a — all relevant sockets.
  • -p — associated process information.

To focus on established TCP connections:

ss -tnp state established

Additional process information may require elevated privileges:

sudo ss -tnp state established

A simplified example might look like this:

ESTAB  0  0  192.168.1.20:51432  203.0.113.10:443
users:(("firefox",pid=4201,fd=88))

Here, the connection is associated with a process named firefox.

Using lsof

If installed, lsof can display network sockets associated with running processes.

lsof -nP -iTCP -sTCP:ESTABLISHED

To investigate a particular process:

lsof -nP -a -p 4201 -i

Replace 4201 with the actual process ID.

Identifying bandwidth usage

If your primary concern is which application is consuming bandwidth, a tool such as NetHogs may be useful.

Depending on your Linux distribution, you can install it through the system’s package manager and run it with the appropriate permissions.

The important distinction is that a connection listing and a bandwidth monitor answer different questions.

One tells you which endpoints are visible. The other helps you understand how much network activity is occurring.

10. How to Check Program Network Activity on macOS

Mac users also have several built-in options.

Method 1: Activity Monitor

Open Activity Monitor from the Applications → Utilities folder, or search for it using Spotlight.

Select the Network tab.

Activity Monitor provides information about network data sent and received by processes and overall network throughput.

It is particularly useful for identifying applications consuming network resources.

See Apple’s official Activity Monitor network guidance.

Method 2: Using lsof

Open Terminal and run:

lsof -nP -iTCP -sTCP:ESTABLISHED

This displays established TCP connections visible to the current account.

To inspect all visible network sockets:

lsof -nP -i

To investigate an individual process:

lsof -nP -a -p 1234 -i

Replace the example PID with the correct process ID.

Some information may require additional permissions.

Method 3: Using nettop

macOS includes a terminal-based networking utility called nettop.

Run:

nettop

It provides a live view of network activity and can help you observe changes over time.

Press q to exit.

11. Which Network Monitoring Tool Should You Use?

Different tools answer different questions.

Tool Operating system Best suited for
Resource Monitor Windows Beginner-friendly process and bandwidth investigation
netstat Windows Quick command-line connection snapshots
PowerShell Windows Filtering and automating TCP investigations
TCPView Windows Live endpoint and process inspection
ss Linux Detailed socket inspection
lsof Linux/macOS Identifying sockets owned by processes
Activity Monitor macOS Application-level network usage
nettop macOS Live network monitoring
Wireshark Multiple platforms Detailed packet-level investigation
Sysmon Windows Configurable historical network event collection
Python with psutil Multiple platforms Custom monitoring and reporting

You do not need to install all of these tools.

Start with the simplest one that answers your question.

12. How to Identify Where a Program Is Connecting

Once you know the process responsible for a connection, the next question is usually:

Where is it connecting?

Suppose you observe:

Remote address: 203.0.113.10
Remote port: 443

An IP address can provide clues, but it does not necessarily identify the exact website, service or organization responsible for the communication.

Modern cloud infrastructure complicates attribution.

A single IP address may host several unrelated websites or services.

Applications frequently communicate through content delivery networks, shared cloud infrastructure, reverse proxies and load balancers.

Reverse DNS lookup

On Windows, you can attempt a reverse lookup using:

Resolve-DnsName -Name 203.0.113.10 -Type PTR

On Linux or macOS, if dig is installed:

dig -x 203.0.113.10

The example address is reserved for documentation and should be replaced with the address you are investigating.

A reverse DNS lookup may return a hostname, but not every IP address has a useful reverse DNS record.

A returned hostname does not necessarily establish which particular service the application contacted.

IP ownership information

IP registration information may help identify the organization responsible for an address range.

You can investigate this using RDAP services or trusted IP ownership lookup tools.

Remember that an address registered to a major cloud provider may host software operated by another organization.

Also consider privacy before submitting internal or sensitive network information to external lookup websites.

13. How to Tell If a Network Connection Is Suspicious

An unfamiliar connection can feel concerning, especially if it belongs to a program that you expected to work offline.

However, unfamiliar does not automatically mean malicious.

A better approach is to collect evidence and evaluate whether the behavior is expected.

At OpenPort, we suggest using the Five-W Network Investigation method.

14. The OpenPort Five-W Network Investigation

This practical method helps you move from a raw network connection to a more informed decision.

W1: Who is connecting?

Identify the application or process responsible for the observed connection.

Useful evidence includes:

  • Process name.
  • Process ID.
  • Executable location.
  • Software publisher.
  • Application version.
  • Whether the process belongs to a known application.

On Windows, you can investigate a process using:

Get-Process -Id 7420 |
    Select-Object Id, ProcessName, Path

You can also inspect the executable’s digital signature:

Get-AuthenticodeSignature `
    -FilePath "C:\Path\To\Application.exe"

Replace the example path with the actual executable path.

A valid digital signature is useful evidence about the publisher and file integrity, but it does not guarantee that a program is safe.

Similarly, unsigned software is not automatically malicious.

W2: Where is it connecting?

Determine whether the destination is:

  • Your own computer.
  • A private network address.
  • A globally routable IP address.
  • A known service associated with the application.
  • An unfamiliar remote system.

Consider the destination port, DNS information and available ownership data.

Avoid assuming that a particular country, hosting provider or port number automatically makes a connection dangerous.

W3: When does it connect?

Timing can provide valuable clues.

Does the connection appear:

  • When the program starts?
  • When you open a particular document?
  • When you enable an AI feature?
  • During software updates?
  • At regular intervals while idle?
  • After installing a new plugin?
  • When the program is supposedly closed?

Understanding timing helps distinguish expected application behavior from activity that deserves further investigation.

W4: Why might it connect?

Look for explanations in the application’s settings, documentation and expected functionality.

For example:

Application behavior Possible explanation
Connection when opening the application Authentication or update check
Connection when saving a document Cloud synchronization
Periodic background communication Notifications, telemetry or license checks
Connection after installing an extension Extension service or dependency
Connection during AI processing Cloud inference, model retrieval or an external tool

These are possible explanations, not proof of the actual activity.

The goal is to determine whether the observation fits what you know about the program.

W5: What should you do next?

Based on the available evidence, choose an appropriate response.

You might:

  • Accept expected communication.
  • Review the application’s privacy settings.
  • Disable an optional online feature.
  • Investigate an unfamiliar executable.
  • Update the application.
  • Restrict unnecessary network access.
  • Run a security scan.
  • Seek professional assistance if there are credible signs of compromise.

This method encourages evidence-based investigation rather than immediate reactions.

15. The Difference Between an Observation and a Security Finding

Suppose a network monitor reports the following:

Process: ExampleEditor.exe
Remote address: 203.0.113.10
Remote port: 443
Time: 09:14:22

What do we actually know?

Statement Evidence level
The operating system associated a connection with ExampleEditor.exe Observed
The connection involved the listed remote address and port Observed
The program was checking for updates Possible explanation
The program transmitted private documents Not established
The program is malware Not established

This distinction is particularly important when investigating unfamiliar network activity.

A monitoring tool provides observations. A reliable security conclusion requires additional evidence.

16. Build a Simple Network Activity Monitor in Python

The tools we have explored are useful, but what if you want to observe newly appearing network connections over a longer period?

Let’s build a small Python utility called OpenPort Connection Watch.

The utility will:

  • Inspect established TCP connections.
  • Identify associated process names when available.
  • Classify remote IP addresses.
  • Record when connections are first observed during monitoring.
  • Optionally focus on a particular application.
  • Optionally display local and private network connections.
  • Save observations in a CSV file.

Unlike a one-time network snapshot, Connection Watch repeatedly examines the operating system’s visible connections.

It is designed to help you investigate your own computer without modifying its network configuration.

The utility does not send network requests, perform remote scans, terminate applications or collect packet contents.

Prerequisites

You will need:

  • Python 3.10 or newer.
  • Windows, Linux or macOS.
  • The psutil Python package.
  • Permission to inspect network activity on the computer.

Step 1: Create a project directory

mkdir openport-connection-watch
cd openport-connection-watch

Create a virtual environment:

python -m venv .venv

Activate it on Windows PowerShell:

.\.venv\Scripts\Activate.ps1

On Linux or macOS:

source .venv/bin/activate

Install psutil:

python -m pip install psutil

Step 2: Create the Python application

Create a file named connection_watch.py.

Copy the following code into it.

import argparse
import csv
import datetime
import ipaddress
import math
import time
from pathlib import Path

import psutil


FIELDS = [
    "timestamp_utc",
    "event",
    "process",
    "pid",
    "process_started",
    "local_ip",
    "local_port",
    "remote_ip",
    "remote_port",
    "remote_scope",
]


def utc_now():
    """Return the current UTC timestamp."""

    return datetime.datetime.now(
        datetime.timezone.utc
    ).isoformat()


def classify_ip(address):
    """Classify an IPv4 or IPv6 destination."""

    try:
        ip = ipaddress.ip_address(
            address.split("%", 1)[0]
        )

        if isinstance(ip, ipaddress.IPv6Address):
            if ip.ipv4_mapped is not None:
                ip = ip.ipv4_mapped

        if ip.is_loopback:
            return "LOOPBACK"

        if ip.is_unspecified:
            return "UNSPECIFIED"

        if ip.is_link_local:
            return "LINK_LOCAL"

        if ip.is_multicast:
            return "MULTICAST"

        if ip.version == 4:
            private_ranges = (
                "10.0.0.0/8",
                "172.16.0.0/12",
                "192.168.0.0/16",
            )

            if any(
                ip in ipaddress.ip_network(network)
                for network in private_ranges
            ):
                return "PRIVATE_NETWORK"

            if ip in ipaddress.ip_network(
                "100.64.0.0/10"
            ):
                return "SHARED_ADDRESS_SPACE"

        if (
            ip.version == 6
            and ip in ipaddress.ip_network("fc00::/7")
        ):
            return "PRIVATE_NETWORK"

        if ip.is_global:
            return "GLOBAL_UNICAST"

        return "OTHER"

    except ValueError:
        return "UNKNOWN"


def get_process_info(pid, cache):
    """Retrieve basic process identity information."""

    if pid is None:
        return "Unknown", None

    if pid in cache:
        return cache[pid]

    try:
        process = psutil.Process(pid)

        info = (
            process.name(),
            process.create_time(),
        )

    except (
        psutil.NoSuchProcess,
        psutil.AccessDenied,
        psutil.ZombieProcess,
    ):
        info = ("Unknown", None)

    cache[pid] = info

    return info


def collect_connections():
    """Collect visible established TCP connections."""

    snapshot = {}
    process_cache = {}

    connections = psutil.net_connections(
        kind="tcp"
    )

    for connection in connections:

        if connection.status != psutil.CONN_ESTABLISHED:
            continue

        if not connection.laddr:
            continue

        if not connection.raddr:
            continue

        name, started = get_process_info(
            connection.pid,
            process_cache
        )

        remote_ip = connection.raddr.ip

        key = (
            connection.pid,
            started,
            connection.laddr.ip,
            connection.laddr.port,
            remote_ip,
            connection.raddr.port,
        )

        snapshot[key] = {
            "process": name,
            "pid": connection.pid,
            "process_started": started,
            "local_ip": connection.laddr.ip,
            "local_port": connection.laddr.port,
            "remote_ip": remote_ip,
            "remote_port": connection.raddr.port,
            "remote_scope": classify_ip(remote_ip),
        }

    return snapshot


def matches_filter(item, process_filter, show_all):

    if process_filter:

        if (
            process_filter.lower()
            not in item["process"].lower()
        ):
            return False

    if not show_all:

        if item["remote_scope"] != "GLOBAL_UNICAST":
            return False

    return True


def format_endpoint(ip, port):

    if ":" in ip:
        return f"[{ip}]:{port}"

    return f"{ip}:{port}"


def display_observation(item):

    local = format_endpoint(
        item["local_ip"],
        item["local_port"]
    )

    remote = format_endpoint(
        item["remote_ip"],
        item["remote_port"]
    )

    print(
        f"[{item['timestamp_utc']}] "
        f"{item['event']} | "
        f"{item['process']} "
        f"(PID {item['pid']}) | "
        f"{local} <-> {remote} | "
        f"{item['remote_scope']}",
        flush=True
    )


def run_monitor(
    duration,
    interval,
    process_filter,
    show_all,
    writer,
    output_file,
):

    started_at = time.monotonic()
    deadline = started_at + duration

    previous = set()
    first_snapshot = True
    observations = 0
    snapshots = 0

    while time.monotonic() < deadline:

        current = collect_connections()
        snapshots += 1

        observed_at = utc_now()

        for key, item in current.items():

            if key in previous:
                continue

            if not matches_filter(
                item,
                process_filter,
                show_all
            ):
                continue

            event = (
                "BASELINE"
                if first_snapshot
                else "NEWLY_OBSERVED"
            )

            record = {
                "timestamp_utc": observed_at,
                "event": event,
                **item,
            }

            display_observation(record)

            writer.writerow(record)
            observations += 1

        output_file.flush()

        previous = set(current.keys())
        first_snapshot = False

        remaining = deadline - time.monotonic()

        if remaining <= 0:
            break

        time.sleep(
            min(interval, remaining)
        )

    print("\nMonitoring completed.")
    print("Snapshots:", snapshots)
    print("Observations recorded:", observations)


def main():

    parser = argparse.ArgumentParser(
        description=(
            "Observe established TCP connections "
            "on the local computer."
        )
    )

    parser.add_argument(
        "--duration",
        type=int,
        default=120,
        help="Monitoring duration in seconds."
    )

    parser.add_argument(
        "--interval",
        type=float,
        default=1.0,
        help="Seconds between snapshots."
    )

    parser.add_argument(
        "--process",
        help="Filter by part of a process name."
    )

    parser.add_argument(
        "--all",
        action="store_true",
        help="Include all remote address categories."
    )

    parser.add_argument(
        "--output",
        default="connection_watch.csv",
        help="Path to a new CSV report."
    )

    args = parser.parse_args()

    if not 1 <= args.duration <= 86400:
        parser.error(
            "Duration must be between 1 and 86400."
        )

    if (
        not math.isfinite(args.interval)
        or not 0.5 <= args.interval <= 60.0
    ):
        parser.error(
            "Interval must be between 0.5 and 60."
        )

    print("=" * 65)
    print("OpenPort Connection Watch")
    print("Read-only TCP connection observation")
    print("=" * 65)
    print("Duration:", args.duration, "seconds")
    print("Interval:", args.interval, "seconds")
    print(
        "Process filter:",
        args.process or "All processes"
    )
    print(
        "Address filter:",
        "All addresses"
        if args.all
        else "Global unicast addresses only"
    )

    print("\nImportant:")
    print("This is a polling-based observer.")
    print("Short-lived connections may be missed.")
    print("UDP traffic is not included.")
    print("Connection direction is not established.")
    print("Process visibility depends on permissions.")
    print("Press Ctrl+C to stop.\n")

    output = Path(args.output)

    try:

        with output.open(
            "x",
            newline="",
            encoding="utf-8"
        ) as output_file:

            writer = csv.DictWriter(
                output_file,
                fieldnames=FIELDS
            )

            writer.writeheader()

            run_monitor(
                args.duration,
                args.interval,
                args.process,
                args.all,
                writer,
                output_file,
            )

    except FileExistsError:
        print(
            "Output file already exists. "
            "Choose another filename."
        )
        return 1

    except psutil.AccessDenied:
        print(
            "Network information is unavailable "
            "with the current permissions."
        )
        return 1

    except KeyboardInterrupt:
        print("\nMonitoring stopped by user.")

    except OSError as exc:
        print(
            "Operating system error:",
            type(exc).__name__
        )
        return 1

    print("Report:", output)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

17. Running OpenPort Connection Watch

To monitor possible external TCP activity for two minutes, run:

python connection_watch.py

By default, the application observes established connections with globally routable unicast remote addresses.

It saves its observations to:

connection_watch.csv

Monitor for five minutes

python connection_watch.py --duration 300 --output five_minutes.csv

Monitor a specific application

For example, to monitor processes with names containing Chrome:

python connection_watch.py --process chrome --output chrome_report.csv

Monitor local AI processes

For example:

python connection_watch.py --process ollama --all --output ollama_report.csv

This includes loopback and private network addresses.

Depending on your local AI architecture, you may also need to monitor the client application, browser, agent runtime or helper processes.

Include all visible connection categories

python connection_watch.py --all --output all_connections.csv

Increase the observation frequency

python connection_watch.py --interval 0.5 --duration 120 --output fast_report.csv

More frequent polling may reveal additional connections, but it can also increase monitoring overhead.

It still cannot guarantee that every connection will be observed.

The utility deliberately refuses to overwrite an existing report.

Use a different output filename for each investigation.

18. Understanding the Python Monitor Results

An illustrative output might look like this:

[2026-11-28T12:00:01+00:00] BASELINE |
browser.exe (PID 4200) |
192.168.1.20:51432 <-> 203.0.113.10:443 |
GLOBAL_UNICAST

[2026-11-28T12:00:07+00:00] NEWLY_OBSERVED |
python.exe (PID 6800) |
127.0.0.1:55012 <-> 127.0.0.1:1234 |
LOOPBACK

The second entry would only be included when using the --all option.

BASELINE

This label means the connection was already visible when monitoring began.

It does not tell you when that connection was originally established.

NEWLY_OBSERVED

This label means a connection was present in the current snapshot but absent from the preceding snapshot.

It does not guarantee that the connection was established at the exact recorded timestamp.

The time represents when our application observed it.

GLOBAL_UNICAST

The remote address was classified as globally routable unicast.

This does not independently prove that the connection used the public internet, or that it was initiated by the local application.

LOOPBACK

The observed remote endpoint belongs to the computer’s loopback interface.

Process identity

The script includes the process ID and process creation time when available.

Operating systems can reuse process IDs after applications exit. Including the creation time helps reduce confusion between different processes that happen to receive the same PID.

However, rapid process changes and permission limitations can still affect attribution.

19. What Our Python Utility Cannot Detect

It is important to understand the limitations of a monitoring tool before trusting its results.

OpenPort Connection Watch is a polling-based educational application.

It does not provide:

  • Guaranteed detection of every TCP connection.
  • Remote UDP communication history.
  • Packet contents.
  • DNS query history.
  • TLS decryption.
  • Accurate per-connection bandwidth measurements.
  • Guaranteed identification of the originating application.
  • Definitive determination of connection direction.
  • Automatic malware detection.
  • Proof that a computer is secure.
  • Complete visibility into every virtual machine, container or network namespace.

On Linux, some connections may be omitted when the current account lacks sufficient privileges.

On macOS, psutil’s system-wide connection enumeration generally requires root permissions.

Always review and trust the code before running it with elevated privileges.

The script is useful for learning and basic investigation, not as a replacement for a production endpoint security platform.

The CSV report may also contain sensitive network addresses and application information. Store it appropriately and review it before sharing it with other people.

20. Try the OpenPort Four-Phase Network Experiment

Now let’s use what we have learned to investigate an application.

This experiment can help you understand how a program behaves under different conditions.

Choose an application you already trust and have installed on your computer.

Phase 1: Establish a baseline

Close the application normally.

Start monitoring your computer for two minutes:

python connection_watch.py --all --duration 120 --output baseline.csv

Observe the existing network activity.

This establishes a reference for the current environment.

Phase 2: Start the application

Start monitoring again:

python connection_watch.py --all --duration 120 --output startup.csv

While the monitor is running, launch the application.

Observe which connections appear.

Some applications communicate during startup even if you do not perform an online task.

Phase 3: Perform a specific task

Start another monitoring session:

python connection_watch.py --all --duration 120 --output task.csv

Perform a clearly defined action inside the application.

Examples include:

  • Open a local text document.
  • Load a trusted website.
  • Start a local AI conversation.
  • Save a file.
  • Open an application’s settings.

Compare the observed connections with the startup session.

Phase 4: Observe idle behavior

Leave the application running without interacting with it.

python connection_watch.py --all --duration 120 --output idle.csv

Check whether new connections appear while the application is idle.

Some applications perform periodic synchronization, update checks or other background operations.

Record your observations

Investigation phase What you observed Possible explanation Further investigation needed?
Baseline
Application startup
Specific task
Idle operation

This experiment does not prove causation.

Other applications may communicate at the same time, and network conditions can change between sessions.

Nevertheless, comparing behavior across these four phases can provide a more useful starting point than examining a single network snapshot.

21. How to Check Whether a Local AI Program Is Connecting to the Internet

Local AI introduces an interesting networking question.

If an AI model runs directly on your computer, why might the surrounding application still communicate with the internet?

Possible reasons include:

  • Downloading models.
  • Checking for application updates.
  • Retrieving model information.
  • Loading extensions.
  • Communicating with optional cloud services.
  • Performing web searches.
  • Accessing external APIs.
  • Running connected AI agent tools.
  • Retrieving information through MCP servers.

A local model and a completely offline AI environment are not necessarily the same thing.

Investigate the complete AI system

Consider this architecture:

AI agent
   |
   +----> Local inference server
   |      127.0.0.1:1234
   |
   +----> Local files
   |
   +----> Browser integration
   |
   +----> External API

The agent may communicate locally with its language model while separately using external services.

Monitoring only the inference server could therefore miss relevant activity.

You may need to investigate:

Component Reason to monitor
Inference engine Model downloads, updates and optional features
AI agent runtime External tool calls and API communication
Browser interface Web content and remote integrations
MCP server Communication with connected resources
Python helper processes Custom scripts and application integrations
Container runtime Published services and container networking

If you are interested in creating your own AI applications, OpenPort’s How to Build an AI Agent in Python guide provides a practical introduction.

Test local AI during an offline task

A useful experiment is to download the required model, complete the necessary setup, and then observe network activity while performing an ordinary local inference task.

If the application supports offline operation, you can also temporarily disconnect your computer from the network and verify whether the required functionality continues working.

Successful offline operation demonstrates that the tested task can work without a network connection under those conditions.

It does not prove that the application never communicates externally when connectivity is available.

For a broader look at this subject, see our guide on how to secure local AI models and agents.

22. When a Network Connection Disappears Too Quickly

A program can establish and close a connection in less time than it takes to refresh a monitoring tool.

This means that even frequent snapshots may miss some activity.

If you need more complete historical visibility, consider event-based monitoring.

Windows Sysmon

Microsoft Sysmon provides configurable system activity logging.

Its network connection event, Event ID 3, can record TCP and UDP network connection information associated with processes.

Network connection logging is disabled by default and must be explicitly configured.

It can generate substantial amounts of data, so configuration and filtering are important.

Sysmon records selected events after it has been configured. It cannot reconstruct historical activity that was never logged.

Learn more from the official Microsoft Sysmon documentation.

Packet capture with Wireshark

Wireshark can capture and analyze network traffic visible to a selected network interface.

It can help investigate:

  • Network protocols.
  • Connection establishment.
  • DNS traffic.
  • TCP and UDP communication.
  • Packet timing.
  • Communication errors.

However, packet capture does not automatically associate every packet with its owning application.

Encrypted communication may also prevent you from inspecting application-level contents.

Packet captures can contain sensitive information, so only capture traffic you are authorized to inspect and store the results securely.

Which approach is best?

Approach Useful for Main limitation
Snapshot Quick connection inspection May miss temporary activity
Polling monitor Observing changes over time Can miss connections between samples
Event logging Historical process and network correlation Requires configuration and storage
Packet capture Detailed traffic analysis Process attribution and encryption limitations

For everyday troubleshooting, snapshots and polling are often sufficient.

More complex security investigations may require several approaches working together.

23. Can You Block a Program From Connecting to the Internet?

Yes, depending on the operating system and available security controls.

However, blocking an application should generally come after understanding its purpose and expected network behavior.

Blocking legitimate communication can interfere with:

  • Security updates.
  • Software activation.
  • Authentication.
  • Cloud synchronization.
  • Multiplayer gaming.
  • Notifications.
  • Connected devices.
  • Application functionality.

Blocking an application on Windows

Windows Defender Firewall with Advanced Security allows you to create application-specific outbound rules.

Open the management interface by pressing Win + R and entering:

wf.msc

Navigate to Outbound Rules and select New Rule.

A program rule can be configured using the path of the relevant executable.

Before applying it:

  • Confirm that the executable is the correct application.
  • Understand which network profiles and destinations are affected.
  • Give the rule a recognizable name.
  • Test the application’s expected functionality.
  • Document how to disable or remove the rule if necessary.

A rule targeting one executable may not cover helper processes or services communicating on its behalf.

Also, an unrestricted outbound block may affect access to private network services as well as internet communication.

If you only want to restrict external communication while retaining local functionality, a more carefully scoped configuration may be required.

Linux and macOS

Application-level outbound filtering depends on the operating system and installed firewall or security software.

On Linux, conventional firewall rules frequently focus on addresses, ports, interfaces or connection characteristics. Application-specific restrictions may require additional mechanisms.

On macOS, the built-in application firewall primarily focuses on incoming connections. More comprehensive outbound application control requires an appropriate additional solution.

Always use supported security mechanisms and avoid disabling existing protections as a troubleshooting shortcut.

24. When Should You Investigate a Network Connection More Closely?

There is no single indicator that proves an application is malicious.

However, combinations of unexpected behavior may justify a closer look.

Observation Why it may deserve review
An unfamiliar executable communicates externally The application identity is unknown
An offline utility unexpectedly accesses external services Behavior may differ from expectations
Communication begins after installing an unknown plugin A new component may be involved
A program sends substantial data while idle The activity needs an explanation
Connections appear alongside unexpected file changes Multiple unusual observations may be related
A program continues operating after being closed Background services or persistence may be involved
Security software reports the same executable Additional independent evidence exists

Each observation can also have a legitimate explanation.

For example, a cloud storage application transferring large amounts of information while idle may simply be synchronizing files.

The goal is to understand the behavior in context.

25. What to Do If You Discover Unexpected Network Activity

If something does not look right, proceed carefully.

Step 1: Record the observation

Write down the process name, PID, remote address, port and time.

If possible, save the monitoring report.

Step 2: Verify the application identity

Check the executable path, publisher and relationship to installed software.

A process name alone is not enough to establish identity.

Step 3: Review recent changes

Consider whether you recently installed an application, browser extension, AI skill, model package, driver or software update.

Step 4: Review official documentation

Look for information about expected network connections, privacy settings and background features.

Step 5: Perform a security scan

Use your trusted endpoint protection software to investigate the application and computer.

Do not download random security utilities simply because an unfamiliar website recommends them.

Step 6: Contain credible threats

If you have credible evidence of unauthorized activity, consider isolating the affected computer from the network.

For business devices, follow your organization’s incident response procedures.

Step 7: Protect sensitive accounts

If credentials may have been exposed, use a trusted device to revoke affected sessions, rotate passwords or API keys, and review account activity.

Seek qualified assistance when the situation involves sensitive business information, financial accounts or a suspected serious compromise.

26. Network Activity Investigation Checklist

The next time you encounter an unfamiliar connection, use this checklist.

  • Identify the associated process.

  • Verify its executable location.

  • Check the software publisher when possible.

  • Record the local and remote endpoints.

  • Distinguish TCP from UDP activity.

  • Determine whether the remote address is local, private or global.

  • Record when the connection was observed.

  • Compare activity during startup, normal use and idle operation.

  • Review the application’s documentation and privacy settings.

  • Check whether a recent installation or update may explain the behavior.

  • Investigate associated helper processes or integrations.

  • Use trusted security software when appropriate.

  • Avoid declaring an application malicious based on a single connection.

  • Restrict communication only when there is an appropriate reason.

You do not need to perform every step for every connection.

Start with the available evidence and investigate further when necessary.

27. Common Mistakes When Investigating Internet Connections

Assuming every connection is suspicious

Most modern computers communicate with remote systems regularly.

Network activity alone is not evidence of compromise.

Looking only at TCP

Modern applications may communicate using UDP, including QUIC-based web traffic.

A TCP-only monitor provides an incomplete view.

Assuming port 443 means everything is safe

Port 443 is commonly associated with encrypted communication.

Encryption protects communication in transit but does not establish that the application or remote service is trustworthy.

Treating an IP address as a website identity

Shared hosting, cloud infrastructure and content delivery networks complicate destination attribution.

Confusing listening services with outbound connections

A listening socket waits for incoming connections. It does not necessarily indicate that a program is actively communicating externally.

Assuming the local process initiated an established connection

A connection snapshot identifies endpoints and state, but may not establish which side initiated the communication.

Trusting a single network snapshot

Applications can communicate briefly or intermittently.

Repeated observations or event-based monitoring may be necessary.

Terminating unfamiliar system processes

Stopping important operating system services can cause instability or disrupt security features.

Investigate before taking action.

Disabling your firewall

Turning off security controls may introduce additional risks.

Use appropriately scoped configuration changes instead.

28. Frequently Asked Questions

How can I see which programs are using the internet on Windows?

Start with Resource Monitor by running resmon and opening the Network tab.

For more detailed connection information, use TCPView, netstat or PowerShell.

Can I check internet connections without installing software?

Yes.

Windows, Linux and macOS include built-in or commonly available networking tools.

Resource Monitor and PowerShell are useful on Windows, ss on Linux, and Activity Monitor and nettop on macOS.

How do I know if an application is sending files?

A network connection alone does not establish what information is being transferred.

You may need application logs, service documentation, bandwidth information or authorized traffic analysis.

Encryption can limit the information available through network capture.

Can a program connect to the internet while I am not using it?

Yes.

Background services can perform synchronization, updates, notifications and other operations when their main user interface is not open.

Does an established TCP connection mean data is being transferred right now?

Not necessarily.

An established connection may remain open while idle.

Use appropriate bandwidth or packet monitoring tools to investigate actual traffic.

Can I monitor a program using Python?

Yes.

Libraries such as psutil can provide process and connection information.

A Python polling utility can help observe connections over time, but it may miss temporary traffic and may have limited visibility depending on permissions.

Can I tell whether a program connects to a particular website?

Sometimes.

DNS information, application logs and network observations may provide useful evidence.

However, shared IP addresses, encrypted traffic, proxies and content delivery networks can prevent definitive attribution from a simple connection listing.

Does a connection to a foreign country mean an application is dangerous?

No.

Many legitimate applications use globally distributed infrastructure.

Geographic information can also be inaccurate or represent a service provider rather than the physical destination.

Can malware hide its network activity?

Sophisticated malicious software may use techniques that reduce visibility or communicate through legitimate processes and services.

A basic network-monitoring utility cannot guarantee that all activity is visible.

Maintain trusted endpoint security and use additional investigation methods when necessary.

Can a local AI model access the internet?

The model itself does not automatically receive internet access.

The surrounding application, inference environment or agent may provide networking capabilities.

Review and monitor the complete system rather than only the model.

Does the OpenPort online port checker show which applications are connecting to the internet?

No.

An online port checker helps investigate whether a particular network endpoint is reachable from an external location.

Identifying outbound application activity requires local connection inspection or other network-monitoring techniques.

Both approaches are useful, but they answer different questions.

29. From Network Curiosity to Better Computer Security

For many years, computer security has focused on protecting systems against malware, unauthorized access, vulnerable software and malicious websites.

These concerns remain important.

However, modern software increasingly communicates across interconnected services, APIs, cloud platforms and AI systems.

A single desktop application may interact with several remote services. A local AI agent may communicate with a model running on the same computer while also accessing external tools. A browser extension may introduce additional background activity.

Understanding these connections is becoming an increasingly valuable part of digital literacy.

You do not need to become a professional network analyst to benefit from this knowledge.

Knowing how to identify a process, inspect its communication endpoints, compare activity over time and distinguish facts from assumptions can already improve the way you understand and protect your computer.

Conclusion: Know What Your Computer Is Communicating With

Your computer’s network activity does not need to remain a mystery.

With a few built-in tools and some basic networking knowledge, you can investigate which applications are communicating, identify their visible destinations and determine whether further investigation is necessary.

Start with Resource Monitor, TCPView, PowerShell, ss or Activity Monitor.

If you want to explore behavior over time, try building and running the OpenPort Connection Watch Python utility.

Remember the Five-W Network Investigation:

  • Who is connecting?
  • Where are they connecting?
  • When does the communication occur?
  • Why might it be happening?
  • What should you do next?

Not every unexpected connection is dangerous. Not every familiar application is automatically trustworthy.

Good computer security begins with curiosity, observation and careful interpretation.

Here is a small challenge for today:

Open a network-monitoring tool on your computer and spend five minutes examining the applications that are communicating.

Can you identify every process?

Do the connections match the applications you are currently using?

Did anything surprise you?

You might discover that your computer is more active than you imagined. And you will finish the exercise with a better understanding of the technology you use every day.

Stay curious, stay informed, and keep exploring.

References and Further Reading

This article is intended for educational, troubleshooting and defensive cybersecurity purposes. Only monitor computers and network traffic that you own or are authorized to investigate. The Python application is an educational utility, not a comprehensive security monitoring solution.

Last technical review: November 2026.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.