AP Networking • Command evidence • Socket-state analysis

Netstat Command Guide

Use netstat as local socket evidence: determine what is listening, which TCP sessions are open, how local and foreign addresses map to client/server roles, what TCP states suggest, and when the next question belongs to the firewall, route, process, or application.

Independent AP Networking resource • Updated 2026-09-09 • Includes 24 free digital flashcards
AP Networking Premium: Add guided practice, answer explanations, artifact work, and structured review to the free study system.
Explore Premium Resources
The netstat evidence model

Read every row as a local socket claim—not a complete network diagnosis

Netstat is most useful when you ask a narrow question: Is a service listening? Which address is it bound to? Did a TCP handshake complete? Which remote endpoint is involved? Which process owns the socket? The command becomes misleading when a single row is treated as proof that the entire network path or application is healthy.

1. ProtocolTCP or UDP?
2. Local endpointWhich local IP and port?
3. Remote endpointWhich peer and port?
4. StateLISTEN, ESTABLISHED, SYN_SENT, etc.?
5. OwnershipWhich process/PID?
6. BoundaryWhat does this prove—and not prove?

This six-part read prevents two common mistakes: treating a listener as proof of remote reachability, or treating an established transport session as proof that the application itself is behaving correctly.

Local socket state

LISTEN answers a server-side question before the firewall is blamed

When a server is expected to accept HTTPS on TCP/443, a local listener is a prerequisite. If no TCP/443 listener exists, remote clients cannot complete a connection to that service even if routing, switching, and firewall policy are perfect. The next question belongs to the service process or its bind configuration.

If a listener does exist, the failure boundary moves outward. Now the relevant questions include which local address the listener is bound to, whether the host firewall permits the traffic, whether upstream policy allows it, and whether connection attempts are actually reaching the endpoint.

Binding scope

127.0.0.1, 0.0.0.0, and one LAN address imply different reachability

ListenerTypical meaningWhat a remote client should expectNext evidence
127.0.0.1:443Loopback-only bindingRemote hosts cannot use that loopback listener directlyService bind configuration
0.0.0.0:443All local IPv4 interfacesPotentially reachable on any permitted local IPv4 interfaceFirewall and path evidence
192.168.50.10:443Specific local interface/addressTraffic to other local addresses may not match this listenerWhich destination address clients are using

Swipe horizontally to see the full table.

A listener's address therefore changes the interpretation. “Port 443 is listening” is incomplete unless you also know where it is listening.

Worked output 1

A service exists—but only on loopback

Proto  Local Address          Foreign Address        State
TCP    127.0.0.1:443          0.0.0.0:0              LISTENING
TCP    192.168.50.10:22       0.0.0.0:0              LISTENING

The host is prepared to accept HTTPS only through loopback in this illustration, while SSH is bound to the LAN address. A remote browser failing to connect to 192.168.50.10:443 is therefore consistent with the local bind state even before a firewall hypothesis is needed.

The discriminating next action is to inspect the web service's bind/listen configuration. If that is corrected to the intended LAN address or all interfaces, then remote reachability should be tested again with firewall policy restored.

Established TCP state

ESTABLISHED proves the TCP handshake for one socket pair—not the application outcome

An ESTABLISHED row is strong transport evidence. It means the TCP handshake completed and the connection remains open for the local/remote address-and-port tuple shown. That proves more than a successful ICMP ping because the relevant TCP service path completed its handshake.

It still does not prove the application returned correct content. HTTPS can establish TCP and later fail during TLS negotiation, certificate validation, authentication, or application processing. A database TCP session can exist while a query fails. The next evidence may therefore come from application logs, protocol responses, or higher-layer diagnostics.

Local and foreign ports

The client usually uses an ephemeral source port while the server uses the well-known service port

Proto  Local Address           Foreign Address         State
TCP    10.20.5.44:51822        203.0.113.20:443        ESTABLISHED

Here the local endpoint is acting as the client. Port 51822 is an ephemeral source port selected for the connection, while the foreign destination port 443 identifies HTTPS. Students who expect “443 on both sides” will misread ordinary client/server behavior.

If the same host were running an HTTPS server, a separate LISTEN row might show local port 443. The role of the port depends on which side initiated the connection and which side offers the service.

TCP state machine evidence

SYN_SENT, SYN_RECEIVED, ESTABLISHED, CLOSE_WAIT, and TIME_WAIT describe different moments

StateWhat it suggests locallyUseful inferenceDo not overclaim
LISTENSocket awaits incoming TCP connectionLocal service is prepared on that bound endpointRemote reachability is not proven
SYN_SENTLocal host initiated handshakeConnection attempt startedFirewall block is only one possible cause of no completion
SYN_RECEIVEDLocal host saw SYN and repliedHandshake progressed furtherFinal completion is not yet shown
ESTABLISHEDHandshake completeTCP session existsApplication correctness is not proven
CLOSE_WAITRemote side closed; local app has not fully closedApplication cleanup behavior may matterNetwork outage is not automatically implied
TIME_WAITRecently closed session retained temporarilyNormal TCP cleanup can be occurringIt is not automatically a failure state

Swipe horizontally to see the full table.

Worked output 2

SYN_SENT narrows the story, but it does not identify the cause by itself

Proto  Local Address           Foreign Address         State
TCP    10.20.5.44:52103        198.51.100.25:443       SYN_SENT

The local client has attempted a TCP connection and has not yet reached ESTABLISHED. That supports a handshake-completion problem. Several explanations remain possible: the server may not be listening, a firewall may be dropping traffic, the destination may be wrong, the return path may fail, or another network condition may prevent completion.

The next evidence should discriminate among those possibilities. On the server, check for a listener. On both sides, verify addressing and route expectations. If permitted, inspect firewall logs or packet evidence to determine whether the SYN arrives and whether a SYN-ACK returns.

UDP boundary

UDP endpoints can be bound without having TCP-style connection states

UDP is connectionless. A UDP socket can be bound to a local port, but there is no TCP three-way handshake and no ESTABLISHED state in the TCP sense. A netstat UDP row therefore cannot be interpreted using the same state-machine logic as TCP.

This is a category boundary, not just a command syntax detail. If a DNS resolver uses UDP/53, the absence of ESTABLISHED is expected. Use TCP vs. UDP when you need to reason from transport behavior rather than memorize column labels.

Process ownership

A port number is more useful when you know which process owns it

On platforms that expose process identifiers through netstat options, mapping a listener to its PID can answer a critical local question: which process actually owns the socket? That helps distinguish “the expected service is listening” from “something else happens to be using the port.”

On Windows, netstat -ano commonly includes numeric addresses and PIDs. The exact flags vary by platform, so AP Networking reasoning should focus on interpreting the resulting artifact rather than assuming identical syntax everywhere.

Routing view

Socket evidence and route evidence answer different questions

Some netstat implementations can display routing information, such as with netstat -r. A route table explains which next hop or interface the host intends to use for a destination. A socket table explains local transport endpoints and states. One should not be substituted for the other.

If a client shows SYN_SENT toward the correct server but the route points out the wrong interface, route evidence may explain why the handshake never completes. If the route is correct but the server has no listener, the socket evidence is more directly useful.

Worked case 3

Ping succeeds, TCP/443 fails, and netstat shows no listener

A server responds to ping from a client, but HTTPS fails. The server's netstat output shows no TCP/443 LISTEN row. That combination should shift attention toward local service state before changing firewall or routing infrastructure. ICMP reachability proves the host can exchange the tested IP traffic; it does not create a missing application listener.

★ CLI Evidence Practice • Netstat Command Guide

A five-minute warm-up for Netstat Command Guide

Tomorrow’s opening question can pick up where this page leaves off: ask students to explain the idea in their own words and apply it to a real network. The 300 Bell Ringers give you short questions and teacher answers you can use without preparing a new starter each morning.

300 AP Networking Bell Ringers
$74.99
BUY TEACHER PACK → See what is included in the 300 Bell Ringers →
Instant Access • Full-Year Teacher Resource

After the web service is started or corrected, verify a local listener exists, then retest the remote HTTPS connection. If the listener exists and the remote test still fails, only then does host/network policy gain stronger diagnostic value.

Worked case 4

A listener exists and one client connects, but another client still fails

Suppose a server shows TCP/443 LISTENING and an ESTABLISHED session from 10.20.5.44, while a client at 10.30.8.22 cannot connect. The listener proves the service is prepared locally, and the established session proves at least one source can complete the TCP handshake.

CLI & Artifact Lab • 120 Missions

Let students try Netstat Command Guide for themselves

Reading the explanation is a start. In the browser simulator, students work through a broken network, choose what to test and see whether their fix worked. It gives them another chance to use what they learned about Netstat Command Guide.

AP Networking Browser Troubleshooting Simulator
$29.99
120 Missions • 60 Failure Patterns • Offline Copy
GET THE SIMULATOR → See all 120 missions & features

Neither observation proves universal reachability. Source-specific firewall rules, VLAN policy, ACLs, routing differences, or different return paths may affect the failing client. The useful comparison is the difference between the working and failing source paths—not another restart of the already-proven service.

Evidence hierarchy

Different netstat observations eliminate different hypotheses

ObservationStronger conclusionStill unknownNext discriminating evidence
No expected listenerLocal service/bind state is incompleteWhether remote path is otherwise healthyProcess/service configuration
Expected listener presentLocal service is prepared on that endpointRemote policy/pathRemote attempt + firewall/path evidence
SYN_SENT persistsClient initiated TCP handshakeWhy reply/completion is missingServer listener, route, firewall, packet evidence
ESTABLISHEDTCP handshake completedApplication successProtocol/application response
One source establishesService works for that source/pathOther source/path behaviorCompare policy and routing by source

Swipe horizontally to see the full table.

Snapshot timing

Socket tables are dynamic, so timing can change what you see

Connections can open and close in milliseconds. A short-lived client session may disappear before you capture netstat output. TIME_WAIT entries can remain after the application has finished. A service restart can remove and recreate a listener. Treat the command as a snapshot of local state at a particular moment.

When diagnosing intermittent behavior, correlate the command output with the actual connection attempt. Repeating the same test while observing socket state can provide far more information than taking one idle snapshot long after the failure occurred.

Artifact Exam Practice • Netstat Command Guide

Check whether Netstat Command Guide has really stuck

Once students have worked through this topic, give them questions mixed in with the rest of the course. The Exam Prep Vault includes practice exams, multiple-choice questions and artifact labs so they cannot rely on a chapter heading to tell them what to do.

AP Networking Complete Exam Prep Vault
$39.99
GET THE EXAM PREP VAULT → See the Exam Prep Vault contents →
4 Practice Exams • 320 MCQs • 60 Artifact Labs
False friends

These netstat observations are useful—but weaker than they first appear

LISTEN

“The port is open.”

It proves a local socket is listening on a particular binding. Remote filtering may still prevent access.

ESTABLISHED

“The application works.”

It proves TCP state for that session, not successful TLS, authentication, query, or application response.

SYN_SENT

“The firewall blocked it.”

Filtering is one hypothesis among several until more path/server evidence exists.

TIME_WAIT

“Something is broken.”

TIME_WAIT is commonly a normal post-close TCP state.

One client works

“Everyone can connect.”

Source-specific routing and policy can differ.

UDP bound

“It should say ESTABLISHED.”

UDP does not use TCP's connection-state model.

Command selection

Use netstat when the question is local socket state; use another tool when the question changes

QuestionNetstat valueBetter complementary evidence
Is the server listening?ExcellentProcess/service configuration
Did a TCP handshake complete?StrongPacket capture or application logs if more detail is needed
Which process owns the socket?Strong when PID option is availableProcess manager/service manager
Which route will be used?Useful with routing viewPlatform route command
Why did a firewall drop the packet?IndirectFirewall logs/rules or packet evidence
Did the application return correct data?LimitedApplication/protocol-specific test and logs

Swipe horizontally to see the full table.

Cross-host comparison

Client and server netstat snapshots become much stronger when they are correlated in time

A client-side SYN_SENT row tells you the client attempted to start a TCP handshake. A server-side LISTEN row tells you the service was prepared locally. Neither one alone tells you whether the client's SYN reached the server. If you capture both sides during the same connection attempt, you can ask a much sharper question: does the server ever show evidence of that client's attempt while the client remains in SYN_SENT?

If the server is listening but never shows any corresponding progress while the client repeatedly attempts the connection, the failure domain shifts toward the path, filtering, destination selection, or some condition before the server's TCP stack receives the traffic. If the server reaches SYN_RECEIVED while the client never reaches ESTABLISHED, the return direction becomes especially important. This is still not a complete packet trace, but correlating both endpoints increases information gain without pretending netstat can see the entire path.

Premium Evidence-Grading Copilot

Spend less time marking explanations about Netstat Command Guide

When students explain their answer, it takes more than a right-or-wrong check to see what they understand. The Grading Copilot helps you review how they used the clues, where their explanation falls short and what feedback to give next. You make the final grading decision.

AP Networking Artifact Analysis Grading Copilot
$49.99
8 Criteria • 5 Task Modes • Offline Premium Copy
GET THE GRADING COPILOT → See the free Copilot preview
Connection churn

Many short-lived rows can reflect normal application behavior rather than a fault

Modern applications may create multiple parallel connections, reuse some sessions, close others quickly, and reconnect to different service endpoints. A busy netstat display can therefore contain many ephemeral ports and TIME_WAIT entries even when the user experiences no problem. The useful question is whether the observed states match the application's behavior and the reported symptom.

For example, a browser opening several HTTPS sessions to content hosts can create many established and recently closed connections. That pattern is different from one application repeatedly remaining in SYN_SENT to the same destination. Quantity alone is weak evidence; repeated state, destination, timing, and correlation with the failure are what make the artifact diagnostic.

NEW • COMPLETE 180-DAY TEACHER CURRICULUM

Teach Netstat Command Guide as part of a planned school year

This page gives you one topic. The 180-Day Teacher Curriculum puts it into a full course plan, with daily teaching notes, student activities and checks for understanding. Use it when you need to know what comes before this lesson and what to teach next.

AP Networking Complete 180-Day Teacher Curriculum
$199.99
180 Lessons • 180 Daily Simulators • 36 Teaching Weeks
GET THE 180-DAY CURRICULUM → See 3 free curriculum examples
Free digital flashcards

24 netstat evidence-and-state flashcards

These cards practice socket-state meaning, local/foreign address reading, TCP state boundaries, UDP differences, listener scope, troubleshooting logic, and AP-style evidence reasoning.

· All netstat cards
Click or press Enter/Space to reveal.
Now state what this observation does not prove.
0 seen•24 cards
AP-style explanation

Build a netstat answer as observation → state meaning → boundary → next evidence

Observation: the server responds to ping but has no TCP/443 listener. State meaning: no local socket is prepared to accept HTTPS on the inspected endpoint. Boundary: this makes local service/bind state a stronger explanation than remote routing, but it does not prove every network path is healthy. Next evidence: inspect the web service process and bind configuration, restore the listener, then retest remote HTTPS.

This structure is stronger than “check the port” because it explains exactly what the socket artifact contributes to the diagnosis.

Continue practicing

Combine socket state with path, port, and command-line evidence

Use Network Command-Line Tools to place netstat beside other host diagnostics, Port Blocked Troubleshooting for selective service failures, Network CLI Output Practice to interpret unfamiliar artifacts, and AP Networking Artifact Analysis to practice bounded inference from technical evidence.