Skip to content

TCP Connections and UDP Exchanges

TCP flags and sequence numbers describe transport state. UDP exchanges require application fields and direction to associate datagrams.

By Reviewed by Jeevesh Kumar

Last updated:

Transmission Control Protocol (TCP) carries an ordered byte stream between endpoints and maintains connection state. User Datagram Protocol (UDP) carries individual datagrams without a transport handshake. The distinction determines which fields can establish a connection, receipt of bytes or a relationship between messages.

Begin with the recorded endpoints, transport protocol and observed directions. For TCP, inspect flags and byte sequence ranges. For UDP, look for the application transaction fields and expected message pattern. Report what the saved capture shows at its observation point before inferring what an application accepted or completed.

Key terms

TCP three-way handshake
The usual SYN, SYN with ACK and returning ACK used to synchronize connection state. Its saved records support a finding about observed establishment.
Sequence number
A TCP position in one direction’s byte sequence space, represented by a 32-bit field. Respect wraparound and distinguish raw from displayed relative values.
Acknowledgment number
The sequence number that a TCP peer reports expecting next when ACK is set. It describes transport receipt of contiguous bytes, while application outcomes require additional evidence.
UDP datagram
One message at the UDP transport layer, with ports, length, checksum and any payload. IPv4 fragmentation can distribute that datagram’s bytes across several records.
Transaction identifier
An application-level value used to relate messages within a protocol. Verify its permitted reuse and match the surrounding context before pairing records.
Reset (RST)
A TCP flag used to reset or reject connection state. The surrounding exchange determines what a recorded reset says about the stage reached.
More key terms (2)
Fragment offset
The position of fragment data within the original IP payload. IPv4 records its offset in units of eight bytes, which matters when checking for gaps.
Half-close
A TCP closure of one sending direction while the other can still carry bytes. Assess FIN and its acknowledgment separately for each direction.

Identify the Observed TCP Connection

Look for the synchronizing flag (SYN) from one endpoint, the SYN and acknowledgment (ACK) flags from the other, and a returning ACK. Record the addresses and ports for both directions. These observations describe the usual TCP opening exchange at the capture point. A lone SYN is evidence of an observed attempt and leaves the presence and outcome of a reply open. Transmission Control Protocol Specification, RFC 9293

Keep the two endpoints and frame references with the observed synchronizing flag (SYN) and acknowledgment flag (ACK).

A capture can begin after setup. Bidirectional data and acknowledgments can still establish that the file contains activity on a TCP connection. Report setup as outside the observed records when its handshake is missing. At the end, the finish (FIN) flag marks the end of sending in one direction, while the reset (RST) flag indicates a reset segment. Look at both directions and relevant acknowledgments before characterizing how much of closing you observed.

Where a capture shows several openings between the same addresses, keep the port pair and the interval with each reference. A connection can be followed by another one that reuses an endpoint address. If ports also recur, the opening sequence and saved time window help distinguish connection instances.

Use Sequence and Acknowledgment Evidence

Read each TCP direction in its own sequence space. A payload occupies a range of sequence numbers, and SYN and FIN each consume a position. An advancing acknowledgment says which sequence number the receiver expects next, reflecting contiguous bytes acknowledged up to that point. A transport acknowledgment leaves the receiver application’s processing or storage outcome unresolved.

A trace can contain repeated or overlapping byte ranges. Tool labels such as retransmission are interpretations based on the observed records and analysis rules. Check both the earlier byte range and later acknowledgment before explaining the label. If the capture contains multiple interfaces or paths, establish which observation produced each record. Timing and sequence context can distinguish repeated observations of the same packet from multiple transmissions.

Wireshark often displays relative TCP sequence values for ease of reading. When comparing an exhibit to another tool, record whether you used relative values or the raw sequence numbers. A relative one in a display can correspond to a large raw number in the packet header.

Associate UDP Datagrams With Application Context

UDP gives you source and destination ports, length and checksum, plus any retained payload. A pair of UDP ports can carry repeated requests, replies or independent messages. Transport itself supplies neither the TCP-style establishment exchange nor acknowledgment of receipt. A tool can group UDP packets into a conversation for analysis. The grouping reflects its criteria. User Datagram Protocol Specification, RFC 768

Scroll horizontally if needed to see the full table.

QuestionTCP EvidenceUDP Evidence
Did transport setup appear?SYN, SYN with ACK and returning ACK where visibleUDP has no transport setup exchange
Were bytes acknowledged?The relevant ACK number and directionAn acknowledgment may exist in the application protocol
Do two application messages belong together?Protocol fields and stream contextProtocol fields, endpoints, direction and timing
Did the application finish its operation?A relevant application response or logA relevant application response or log

Use the application’s rules to associate datagrams. For a Domain Name System (DNS) request and reply, compare the transaction identifier, endpoints, message direction, query name and query type along with the interval. A matching identifier alone is weak where the same numbers can recur. Other UDP applications define their own message units and acknowledgments, so specify whether the evidence comes from a UDP field or from the carried protocol. Domain Names Implementation and Specification, RFC 1035

Use the Domain Name System’s matching context to associate UDP records, especially when similar questions repeat.

Pair UDP datagrams in the order the application expects. A later datagram with the right identifier can belong to a retry when there were repeated questions. Keep the candidate request frames and response direction in your notes. If message fields leave the pairing ambiguous, say which relationship remains unresolved.

State Which Stage the Capture Shows

Record whether you saw establishment, payload, opposite-direction traffic, acknowledgment and closure in the saved records. If a question concerns a particular request, explain how the application message was linked to the connection or datagrams. Use frame numbers and endpoint roles. If a reader is following a reconstructed stream, preserve the frames needed to show timing and explain which view supplied which observation.

When a reply is missing, check the interval, capture direction and retained data before deciding what the absence means. A UDP request can have several replies, a later retry or no expected reply at all depending on the application. A TCP acknowledgment can support receipt even when the application response is outside the saved interval. Frame the conclusion around observable transport and application milestones.

A short transport timeline can keep distinct questions visible. Give a row to first observed connection activity, a row to a matching acknowledgment, and another to any application response. Include the interface and frame number for each. A reviewer can then see exactly which stage supports the finding.

Read a TCP Half-Close in Both Directions

A TCP endpoint can finish sending and still receive data from the other endpoint. Read a finish flag (FIN) as the end of that sender’s byte stream and look for acknowledgment of its sequence position. To decide whether both directions finished within the saved interval, examine a FIN and its acknowledgment for each side. TCP Specification, RFC 9293, Section 3.6.1

In the hypothetical Status Reply Practice, the client sends its test input and then a FIN at sequence 401. A server frame acknowledges 402, which accounts for the FIN, and carries an 80-byte status message. A subsequent server frame carries its own FIN and the client acknowledges it. List each FIN separately with the server payload between them. The record shows that a response followed the end of client sending while the server’s sending direction remained open.

Read each finish flag (FIN) in its own direction. The hypothetical response follows the end of client sending while the server direction is still open.

If the file ended immediately after the server payload, the client-side FIN and its acknowledgment would remain supported observations. Closure of the server’s sending direction would be outside the visible sequence. A status value in the payload involves the application protocol and needs its own interpretation.

Recognize a Connection Protocol Carried Inside UDP

UDP supplies the enclosing datagram, while a carried protocol may manage connections, streams and acknowledgments. QUIC is one example. Its packets travel inside UDP datagrams, and a single datagram can carry more than one QUIC packet. Identify whether the exhibit counts saved frames, datagrams or decoded QUIC packets before interpreting the total. QUIC Transport, RFC 9000, Section 12.2

In the hypothetical QUIC Datagram Practice, a saved test trace shows a client datagram with an Initial packet. A reply datagram contains two QUIC packets, an Initial and a Handshake packet. Put one row per datagram in a transport exhibit and show both decoded packet types for the reply. The two datagrams contain three observable QUIC packets. The packet types support a finding about observed connection-establishment traffic.

If the examiner needs to establish application request completion, check which relevant fields are visible and what an authorized endpoint or service record can confirm. Protected later traffic can leave application content unavailable in the capture. A UDP port or a visible QUIC packet type supplies transport context while the application outcome remains a separate question.

Read Sequence Numbers Across Wraparound

TCP sequence numbers use a 32-bit space. After 4,294,967,295, the next position is zero. Interpret sequence ranges and acknowledgments modulo 2³², within the direction and connection being examined. A numerically smaller acknowledgment can advance normally when it crosses the boundary. The raw header value and the viewer’s relative number describe the same position on different scales. TCP Sequence Numbers, RFC 9293

Scroll horizontally if needed to see the full table.

ObservationRaw sequence positions
First four payload bytes4,294,967,292 through 4,294,967,295
Next four payload bytes0 through 3
Acknowledgment of this range4, the next expected position

In a hypothetical saved connection, one data segment starts at raw sequence 4,294,967,292 and carries eight bytes, with no SYN or FIN flag. Its first four bytes occupy the last four positions in the sequence space. The remaining bytes occupy positions zero through three. A peer acknowledgment of four is therefore consistent with receipt through the last payload byte in that range.

Track raw sequence numbers in order across the 32-bit wrap. The acknowledgment covers all eight positions in this hypothetical segment.

Use the ordered ranges and peer direction to support the association. When making a table, state whether the numbers are raw or relative. If tracing a sequence across files, record enough original header values and connection context for a reviewer to reconcile differences in the viewer’s starting point. A midstream trace may lack the opening sequence numbers and can still show a coherent local sequence of bytes and acknowledgments.

A small acknowledgment after wraparound measures movement across the boundary only when the connection context supports that ordering. If records from two separate connection instances share a tuple, identify the applicable handshake or other stream boundaries before applying the calculation.

Interpret a Reset in Its Connection Stage

A segment with the TCP reset flag (RST) can appear during an attempted open or after data has already been exchanged. Its significance depends on the segment sequence, acknowledgment fields and the state the endpoint had reached. TCP can generate resets in several conditions, and an application can also request an abort. TCP Reset Generation and Processing, RFC 9293

In a hypothetical trace, a test client sends a SYN with sequence 400 and the opposite direction returns RST and ACK with acknowledgment 401. The response is consistent with a reset sent to reject the observed opening attempt. That exchange alone leaves open whether a middlebox or the destination endpoint generated the reset and why. Compare a service-side trace or a documented gateway action when the distinction affects the finding.

In a second hypothetical trace, a responder sends a reset after acknowledging some request bytes. Record the last acknowledged byte range, any preceding application response and the reset direction. This gives a reviewer the transport stage visible at the time of the reset. If the class exercise asks whether an operation occurred before the reset, a service-side operation record may establish a result that never appeared in the captured response.

Reconstruct a Fragmented UDP Datagram Before Pairing Messages

An IPv4 datagram carrying UDP can be split into fragments, with IPv4 offsets locating the fragments within the original payload. The UDP header begins in the offset-zero fragment. Later fragments carry following bytes of that original IPv4 payload. UDP length covers the complete UDP header and application data, so it can exceed the IPv4 payload in any single fragment. Internet Protocol Fragmentation, RFC 791 User Datagram Protocol, RFC 768

In a hypothetical two-fragment capture, the offset-zero fragment carries 1,200 IPv4 payload bytes and its UDP header declares a length of 1,408. A matching final fragment has a raw offset of 150, meaning 1,200 bytes, and carries the remaining 208 bytes. Verify the IPv4 source, destination, protocol and identification together within the relevant time window. Then check that the saved fragments cover the full declared UDP length before interpreting the reassembled application message.

Match the IPv4 fragmentation identifiers and check full coverage of the declared UDP length before interpreting the application message.

If the final fragment is missing, record the ports and total UDP length if visible, plus any retained part of the application header. A transaction identifier in the saved prefix might help associate a reply under the application’s matching rules. State which proposal it supports and what payload data remain unavailable. If the offset-zero fragment is missing instead, the later fragment by itself may provide no UDP ports or identifier.

Casework Example

Lesson Review

Check Your Understanding

Question 1 of 5· 0 answered
What evidence supports observing a normal TCP opening handshake?

Test yourself on Network Forensics with free, timed mocks.

Practice Network Forensics questions

Found this useful? Pass it along.