34 min read

TCP vs UDP: The Complete Guide to Network Protocols

TCP vs UDP deep dive: three-way handshake, QUIC, WebRTC, how Google/Netflix/Microsoft choose protocols, and why Localtonet is the only tunnel service with native UDP support.

Networking · Transport Protocols · TCP · UDP · Localtonet · 2026

Understand transport behavior before choosing or exposing a network service

TCP and UDP provide different transport semantics rather than a simple choice between reliability and speed. TCP presents applications with a reliable, ordered byte stream and includes flow control, retransmission, and congestion control. UDP preserves datagram boundaries but leaves delivery recovery, ordering, pacing, and congestion response to the application or a higher-level protocol. This guide explains both transport protocols, covers DNS, QUIC, HTTP/3, WebRTC, and SCTP, and shows how to publish a local TCP, UDP, or combined UDP/TCP service safely with Localtonet.

🌐 TCP streams and UDP datagrams 🔍 DNS, QUIC, WebRTC, and SCTP 🔒 Safe public tunnel operation
TCP uses an ordered acknowledged connection, while UDP sends independent datagrams without delivery guarantees.
TCP prioritizes reliable ordered delivery; UDP provides independent messages with less base transport machinery.

TCP vs UDP: the quick answer

The practical difference

TCP, the Transmission Control Protocol, establishes a connection and gives an application a reliable, ordered stream of bytes. It retransmits missing data, suppresses duplicate data, applies receiver flow control, and participates in congestion control. TCP does not preserve application message boundaries, and it cannot promise that a connection will survive every network or endpoint failure.

UDP, the User Datagram Protocol, sends independent datagrams without establishing a transport connection. It preserves datagram boundaries but does not itself retransmit lost data, restore order, suppress duplicates, or provide flow and congestion control. An application that needs those properties must implement them or use a protocol, such as QUIC, that supplies them above UDP.

TCP and UDP are transport protocols carried above IP. Calling them transport protocols is more precise than describing them broadly as network protocols because the IP layer handles packet addressing and routing, while TCP and UDP provide process-to-process transport through ports.

UDP is not inherently faster for every workload. Its header and base protocol are simpler, and it avoids TCP connection establishment, but useful performance depends on the complete system. A poorly paced UDP application can cause loss or congestion, while a well-tuned TCP implementation can efficiently transfer large amounts of data. Choose according to the semantics the application requires, not according to a universal claim that one protocol is faster.

Property TCP UDP
Application interface Ordered byte stream Individual datagrams
Connection setup Normally begins with a three-way handshake No transport handshake
Loss recovery Built-in acknowledgment and retransmission machinery Not provided by UDP
Ordering Delivers stream bytes in order Datagrams can arrive out of order
Message boundaries Not preserved Preserved
Flow control Built in Application responsibility
Congestion control Required behavior, with implementation-specific algorithms Application or higher-level protocol responsibility
Minimum transport header 20 bytes without options 8 bytes
Base specification RFC 9293 RFC 768

How TCP works

TCP handshake followed by ordered data transfer and retransmission of a lost segment.
TCP establishes connection state with SYN, SYN-ACK, and ACK before providing an ordered, retransmitted byte stream.

TCP is specified by RFC 9293, the current TCP base specification. It superseded the original RFC 793 specification. Additional standards define important behavior such as TCP congestion control and selective acknowledgment. TCP runs above IP and identifies communicating applications through transport ports.

The service TCP provides is a full-duplex byte stream. If an application writes two buffers, the receiver might read them as one larger block, several smaller blocks, or another grouping. The receiving program cannot infer application messages from individual TCP segments or individual write calls. Applications need framing such as a length field, delimiter, fixed-size record, or protocol-defined structure.

Connection establishment

A normal active TCP connection begins with a three-way handshake. The exchange verifies two-way reachability at that moment and synchronizes each endpoint's initial sequence-number space. TCP options supported by both endpoints can also be negotiated during connection establishment.

1

SYN

The initiating endpoint sends a segment with the SYN control flag and an initial sequence number.

2

SYN and ACK

The listening endpoint acknowledges the first SYN and supplies its own SYN and initial sequence number.

3

ACK

The initiator acknowledges the peer's sequence number. Once the required state transitions complete, the connection can carry the application's byte stream.

This is the usual sequence, not a claim that every possible TCP state transition looks identical. TCP also defines behavior for cases such as simultaneous open. Extensions can allow data in connection-establishment exchanges, so the handshake is best understood as connection-state and sequence-number synchronization rather than an absolute prohibition on application data.

Reliability, flow control, and congestion control

🔢 Sequence numbers TCP numbers stream bytes. Sequence information lets a receiver place data correctly, detect gaps, and avoid delivering duplicate bytes to the application.
✅ Acknowledgments Acknowledgments are commonly cumulative. Receivers can delay an ACK or acknowledge several segments together, while selective acknowledgment can identify additional received ranges.
🔁 Retransmission A sender can infer missing data from timers or acknowledgment patterns and retransmit it. If recovery cannot succeed, the connection eventually fails.
🚿 Flow control The receiver advertises available window space so a sender does not overrun the receive buffer. This protects the receiving endpoint, not the network as a whole.
🚦 Congestion control TCP limits traffic according to its model of available network capacity. Algorithms and signals vary by implementation, so packet loss is not the only possible congestion signal.
🧮 Checksum The TCP checksum covers the header, data, and an IP-derived pseudo-header. It detects many accidental errors but is not cryptographic authentication.
What TCP reliability actually means

While a healthy connection makes progress, the receiving application sees the byte stream in order and without duplicate bytes. TCP does not guarantee that every original IP packet arrives. Packets can be lost and their data replaced through retransmission. A crash, path failure, timeout, reset, or application error can terminate the connection before all intended data is delivered. Applications that require transactional certainty still need application acknowledgments, durable storage, idempotency, or resume logic.

Head-of-line blocking

If a TCP segment carrying an earlier part of the stream is missing, later bytes cannot be delivered past that gap as part of the ordered stream, even if those later bytes have reached the receiver. This transport-level head-of-line blocking matters when unrelated logical operations are multiplexed over one connection.

HTTP/2 multiplexes application streams over one TCP connection, but a missing TCP byte can temporarily hold up data for multiple HTTP/2 streams whose bytes follow that gap. This limitation helped motivate QUIC's stream-aware transport design. TCP remains appropriate when a single reliable ordered stream is exactly what the application needs.

Connection shutdown

TCP supports independent shutdown in each direction. A common graceful close includes a FIN and acknowledgment for one direction followed by a FIN and acknowledgment for the other. It is often illustrated as four segments, but four separate messages are not mandatory. An ACK can be combined with a FIN, one direction can remain open during a half-close, and an abortive shutdown can use a reset. The observed exchange depends on endpoint state, application behavior, and timing.

How UDP works

UDP datagrams travel independently and may be lost or arrive out of order without acknowledgment.
UDP sends independent datagrams without connection setup, ordering, or transport-layer retransmission.

UDP is defined by RFC 768. Its header contains source port, destination port, length, and checksum fields. Unlike TCP, UDP preserves message boundaries. One application send normally creates one UDP datagram, although IP may fragment the resulting packet along the path.

UDP does not establish a transport connection before sending. That avoids TCP's connection-state machinery, but it does not make delivery immediate or assured. Routing, queues, firewalls, network address translation, radio conditions, receiver load, and application processing still affect latency and loss. Datagrams can be dropped, duplicated, delayed, or reordered.

📦 Datagram boundaries Each UDP message is presented as a distinct unit at the receiving socket. Applications should enforce maximum sizes and validate every message length.
⚡ No transport setup An application can send without a TCP-style handshake. A higher-level secure or reliable protocol may still introduce its own setup exchange.
🧩 Application-controlled recovery An application can ignore stale data, retransmit selected messages, add forward error correction, or build reliable streams according to its needs.
📣 One-to-many IP delivery UDP can be used with IP multicast and, where a network permits it, broadcast. A public tunnel does not imply that local broadcast or multicast behavior will be reproduced.

Datagram boundaries and receive-buffer truncation

A successful datagram receive operation obtains one UDP datagram, not an arbitrary portion of a continuous stream. That statement describes message boundaries, but it does not mean every receive buffer is automatically large enough. If the application supplies a buffer smaller than the received datagram, many socket APIs copy only the portion that fits and discard the remaining bytes from that datagram. A later receive does not normally return the discarded remainder as though it were the next part of a stream.

The exact indication differs by operating system, programming language, and receive function. An API may return a truncation flag, report the original datagram length, return only the copied length, or signal an error. Applications must consult their socket API, allocate an appropriate maximum buffer, inspect truncation indicators where available, and reject incomplete messages. UDP's transport-level preservation of a datagram boundary does not guarantee that an application using an undersized receive buffer obtains the entire payload.

Transport behavior and socket API behavior are different layers

UDP preserves datagrams across the transport interface, but a particular API controls how an application receives them. TCP provides a byte stream, but a particular read call can still return fewer bytes than requested. Correct programs loop and frame TCP reads, while UDP programs validate message size and detect truncation according to the API they use.

UDP checksums on IPv4 and IPv6

The UDP checksum covers the UDP header and payload plus an IP-derived pseudo-header. With IPv4, a transmitted checksum field of zero indicates that the sender omitted the UDP checksum. With IPv6, ordinary UDP usage requires a nonzero checksum. Narrow exceptions exist for specifically defined IPv6 tunnel scenarios, but general applications should not assume that the IPv6 UDP checksum is optional.

Like the TCP checksum, the UDP checksum is an error-detection mechanism rather than encryption, message authentication, or peer authentication. Sensitive traffic still needs a secure protocol with appropriate confidentiality and integrity protection.

Datagram size, fragmentation, and congestion

A large UDP datagram can exceed the usable packet size on a path. It may be fragmented by IP where fragmentation is supported, or fail when it is not. Losing one fragment prevents reassembly of the complete datagram. Robust UDP protocols therefore use conservative payload sizes and path-aware strategies rather than assuming that every network accepts the same large message.

UDP has no built-in congestion control. Internet applications using UDP should pace traffic and respond to signs of congestion. The IETF's UDP usage guidelines in RFC 8085 describe responsibilities for application designers, including congestion control, message sizing, reliability, checksums, and middlebox behavior.

QUIC is an important example of the distinction between UDP itself and a protocol built above it. QUIC uses UDP packets but adds acknowledgments, loss detection, reliable streams, flow control, and congestion control. Choosing UDP is not permission to transmit without regard for network capacity.

When to use TCP, UDP, or both

Start with application semantics. If an application consumes a reliable ordered stream and older data remains useful, TCP is often the straightforward choice. If messages are independently useful, stale messages quickly lose value, or the application requires IP multicast or broadcast on a local network, UDP may fit better. Building safe reliability, pacing, and congestion response above UDP is substantially more involved than simply sending datagrams.

Requirement Likely starting point Reason
Reliable ordered byte stream TCP Ordering, retransmission, flow control, and congestion control are built in.
Independent time-sensitive messages UDP or a UDP-based protocol The application can discard stale updates instead of waiting for stream recovery.
Reliable multiplexed encrypted streams QUIC where supported QUIC provides secure transport features above UDP and separates stream delivery.
Simple request and response with protocol-defined retry Often UDP, depending on the protocol The protocol can retry the complete transaction and may define TCP alternatives.
Bulk transfer where every byte matters TCP or a reliable protocol above UDP The transfer needs recovery, congestion control, and completion validation.
Local multicast or broadcast discovery UDP TCP does not provide broadcast or multicast transport sessions.

Common TCP-oriented workloads

Traditional remote shells, many database wire protocols, mail transfer, file transfer, and HTTP/1.1 or HTTP/2 usually expect TCP semantics. Their records, requests, and responses must arrive in the correct byte order. TLS can secure protocols running over TCP, but TCP by itself does not encrypt traffic or authenticate either endpoint.

Common UDP-oriented workloads

Interactive media, some game-state updates, telemetry, service discovery, and certain request-response protocols can benefit from independent datagrams. This does not mean every game, media service, or sensor system always uses UDP. Designs vary, and many applications combine reliable control traffic with time-sensitive media or state traffic.

Using both transports

An application can use TCP and UDP for different functions, but those functions do not necessarily share a port. A system might use a reliable TCP control channel on one port and UDP media datagrams on another. Other protocols are intentionally designed to accept TCP and UDP on the same numeric port.

Localtonet supports TCP, UDP, and combined UDP/TCP tunnel categories. Use a combined tunnel only when the service actually listens for both transports at the same local IP address and port. If the application uses different local ports, configure tunnels that match its real protocol and port arrangement instead of treating a combined tunnel as a way to merge unrelated endpoints.

DNS, QUIC, HTTP/3, WebRTC, and SCTP

Transport relationships for DNS, QUIC, WebRTC media, and SCTP data channels.
Modern applications may use TCP, UDP, or layered transports such as QUIC and SCTP carried within a larger protocol stack.

Modern DNS transport behavior

DNS is not accurately summarized as “UDP until a response exceeds 512 bytes.” Traditional DNS commonly uses UDP, but EDNS, specified by RFC 6891, lets endpoints advertise a larger supported UDP payload size. Operators often choose conservative sizes because fragmented responses can be unreliable across real networks.

If a UDP DNS response carries the truncation indication, a resolver can retry using TCP. Current guidance for DNS over TCP appears in RFC 7766. Conventional full zone transfers also use TCP. Encrypted DNS introduces further transport choices:

  • DNS over TLS, or DoT, carries DNS over a TLS-protected connection as defined by RFC 7858.
  • DNS over HTTPS, or DoH, carries DNS through HTTP as defined by RFC 8484. Its underlying transport depends on the negotiated HTTP version.
  • DNS over QUIC, or DoQ, carries DNS directly over QUIC according to RFC 9250.

When exposing a DNS implementation for testing, verify every transport the implementation claims to support. A UDP-only tunnel cannot test TCP fallback, DoT, or an HTTPS endpoint. Public recursive DNS also creates significant abuse risk and should not be exposed without strict controls and an intentional security design.

QUIC and HTTP/3 are separate standards

QUIC is standardized in RFC 9000. Its use of TLS is specified in RFC 9001, while RFC 9002 covers loss detection and congestion control. HTTP/3 is standardized separately in RFC 9114 as the mapping of HTTP semantics onto QUIC. QUIC is therefore not another name for HTTP/3.

QUIC uses UDP as its substrate but adds secure connection establishment, acknowledgments, loss detection, reliable streams, flow control, and congestion control. A gap in one QUIC stream does not by itself prevent another stream from delivering data that is ready. The complete behavior is more nuanced than saying one lost packet affects only one stream. A packet can carry frames for multiple streams or connection-level state, and connection-wide congestion response can influence every stream sharing the connection.

WebRTC, RTP, DTLS, and signaling

The W3C WebRTC specification defines browser APIs used for real-time communications, while the full system relies on multiple IETF protocols for connectivity, media, security, and data channels. Interactive media commonly uses RTP, originally defined in RFC 3550, with SRTP protection. DTLS-SRTP, specified by RFC 5764, establishes keying material for protected media.

WebRTC does not define one universal signaling protocol. Applications exchange offers, answers, and connectivity candidates through an application-defined path such as HTTPS, WebSocket, SIP, or another mechanism. DTLS protection for media does not automatically secure this external signaling path. The signaling application must secure its own transport and authenticate participants.

ICE coordinates connectivity checks using candidates gathered from local interfaces and services such as STUN and TURN. Direct UDP connectivity may be preferred, but relay and fallback behavior depend on the deployment. A generic UDP tunnel is not a replacement for the complete ICE, TURN, identity, and media-security design.

SIP and RTP have different roles

SIP is a signaling protocol used to establish, modify, and end communication sessions. It is not itself the voice or video media stream. RTP and RTCP commonly carry and monitor media after signaling negotiates a session. A voice deployment can consequently use several protocols and ports. Inspect the actual server configuration before designing tunnels or firewall rules.

SCTP and WebRTC data channels

SCTP, currently specified by RFC 9260, is a message-oriented transport that supports reliable delivery, multiple streams within an association, and multihoming capabilities. Independent streams reduce delivery blocking between streams, although congestion and path behavior still operate at broader scopes.

Direct SCTP deployment on the public internet can encounter middlebox compatibility constraints. WebRTC data channels use SCTP carried over DTLS according to the WebRTC data channel protocol in RFC 8831, avoiding a requirement for browsers to expose native SCTP directly to the public network.

Prerequisites and Localtonet client installation

Localtonet exposes a service reachable from your device through a public host and port. The Localtonet client establishes an outbound connection to our relay, so the tunnel itself does not require inbound router port forwarding, a public IP address, firewall changes, or a separate VPN setup.

The current Localtonet download and installation documentation provides clients for Windows 64-bit, 32-bit, ARM, and ARM64 systems; Linux 64-bit, ARM, ARM64, and corresponding MUSL builds; macOS 64-bit and ARM64; Docker; and Android. It also documents a Termux ARM64 console-client option for Android and experimental OpenWrt packages for supported x64 and ARM64 firmware versions. Choose a build that matches the operating system and processor architecture of the device that can reach your service.

💻 A running local service The TCP listener, UDP listener, or dual-protocol service must already be running on the client device or reachable from it over the local network.
📍 Correct local target Know the local IP address and port. Use loopback when the service and Localtonet client share a host and no separate network path is required.
🔑 Device authentication token Use the token for the device that will run the tunnel. Treat it as a credential and keep it out of source code, screenshots, tickets, and logs.
🌐 Current relay selection Choose an available relay server or region from the current product. Do not reuse a server code copied from an old tutorial.
🧭 Known protocol layout Confirm whether the application uses TCP, UDP, or both, and whether both transports actually share the same local port.
🔒 Application security Configure authentication, authorization, encryption, and appropriate access restrictions before making the service publicly reachable.
Verify the local service before opening a public endpoint

A tunnel cannot repair a service that is stopped, listening on the wrong address, blocked by a host firewall, or configured for a different transport. Test the local target from the Localtonet client device first. If the target is another LAN device, test from the Localtonet device rather than only from the service host.

Desktop, Docker, Android, and other installation paths

For Windows and macOS, download the build matching the operating system and processor architecture, install or extract it as directed by the current download page, and run the client on the machine that can reach the target service. Linux users can choose the appropriate standalone architecture build or use the maintained DEB and RPM package workflow described below. Docker is available when a containerized client fits the deployment, but the container must have network reachability to the local target.

The Android application is a supported client path. For ARM64 Android devices that need the console client, the documentation also provides Termux ZIP and DEB packages. OpenWrt support is marked experimental and is limited to the listed x64 and ARM64 packages. OpenWrt package format and firmware version must match, and MIPS, MIPSEL, and ARMv7 are not supported by those packages. Check available storage, memory, architecture, and the current package instructions before installing on a router.

Linux DEB and RPM requirements

Installable DEB and RPM packages are available for x64 and ARM64. They require systemd 247 or newer and OpenSSL 3. Documented examples of suitable platforms include Debian 12, Ubuntu 22.04 or newer, and RHEL 9. Confirm these prerequisites before using the package workflow. If the host does not meet them, select another currently supported build rather than forcing an incompatible package.

Download the package for the machine's architecture, open a terminal in the directory containing it, and install it with the appropriate package manager. Use the filename that matches the downloaded architecture.

# Debian or Ubuntu, x64
sudo apt install ./localtonet-linux-x64.deb

# Debian or Ubuntu, ARM64
sudo apt install ./localtonet-linux-arm64.deb
# Fedora or RHEL, x64
sudo dnf install ./localtonet-linux-x64.rpm

# Fedora or RHEL, ARM64
sudo dnf install ./localtonet-linux-arm64.rpm

Configure and protect the Linux authentication-token file

After installing the package, edit /etc/localtonet/auth-token as root. Replace the package's placeholder with the actual device authentication token on one line. Do not include the real token in a shell history, article, screenshot, repository, or support message.

Restrict the file to its owner, then run the documented configuration check. The check should succeed before the system service is started.

sudo chmod 600 /etc/localtonet/auth-token
sudo localtonet --headless --authtoken-file /etc/localtonet/auth-token --check-config
The authentication-token file is a credential file

Mode 600 limits access to the file owner, but host administrators must still protect backups, terminal recordings, configuration-management output, and support bundles. If the token is disclosed, rotate or revoke it through the current account workflow.

Start the Linux service and inspect logs

Once the configuration check succeeds, enable and start the standard Localtonet service. Then inspect its journal to confirm that the client starts correctly. This service is for the regular Localtonet client used by TCP, UDP, and UDP/TCP tunnels. VPN Manager has a separate service workflow and is not required for a standard port tunnel.

sudo systemctl enable --now localtonet.service
sudo journalctl -u localtonet.service

The journal command displays service output. Use the normal journal controls on the host to follow or limit output when troubleshooting, and avoid copying sensitive content into public reports. Confirm that the intended device connects before creating or starting a tunnel.

Upgrade a Linux package installation

To upgrade, download and install the new package through the same package manager. The documented package workflow preserves the configuration. Restart the standard service after installation so the new version is running:

sudo systemctl restart localtonet.service

After restarting, inspect the service journal and confirm device connectivity before relying on an existing tunnel. An upgrade does not remove the need to verify the local application, client connection, and tunnel running state.

How to create and run a TCP, UDP, or UDP/TCP tunnel

A public TCP or UDP endpoint connects through a Localtonet relay to a service on a private host.
A running tunnel maps the selected public transport to the matching local service address and port.

The tunnel category must match what the local application listens for. A TCP client cannot communicate with a UDP-only service merely because both use the same numeric port, and the reverse is also true. The shared documented workflow for these raw-port tunnels is to run the client, choose the tunnel type, select the connected device token and relay server, provide the local target, and start the tunnel.

1

Install and run the Localtonet client

Run the current client on the device that can reach the service. Authenticate that device and confirm it is connected before configuring the tunnel.

2

Choose TCP, UDP, or UDP/TCP

Choose TCP for a TCP listener, UDP for a UDP listener, or combined UDP/TCP only when both transports use the same local IP address and port.

3

Select the AuthToken

Select the device-specific token associated with the connected client that will run this tunnel. Do not expose or guess a token.

4

Select an available server

Choose a relay server or region currently offered in the product. Availability can vary, so use the current list rather than a hardcoded server code.

5

Enter the local IP address and port

Provide the verified address and port of the service as reachable from the Localtonet client device. Confirm that the selected transport matches the listener.

6

Start the tunnel

Creating the configuration does not start it. Use the Start action and wait for the tunnel to report that it is running before testing the assigned public host and port.

Tunnel availability has two active dependencies

The selected Localtonet client must remain connected, and the tunnel must remain started. A saved configuration alone does not provide a reachable endpoint. Stopping the client, disconnecting the device, or stopping the tunnel interrupts public access.

Configure the remote application with the public host and port assigned to the running tunnel. When access is no longer required, stop the tunnel. Delete it if the configuration will not be reused. Stopping and deleting are distinct lifecycle actions: stopping removes current availability while retaining the saved configuration, and deleting removes the configuration.

Choosing a safe local bind address

If the service and Localtonet client run on the same machine, binding the service to loopback can reduce unnecessary LAN exposure. If the service runs inside a container, virtual machine, or another local device, the Localtonet client needs a target address it can actually reach. Do not change a service to listen on every interface unless necessary and protected by appropriate host and application controls.

Container networking deserves particular attention. A loopback address inside one container refers to that container, not automatically to the host or another container. Verify connectivity from the environment where the Localtonet client runs and use the reachable address established by the container or virtual-network configuration.

Verify operation and troubleshoot failures

Verify TCP locally and publicly

First connect to the local TCP target from the Localtonet client device using the application's normal client. A successful socket connection is only the first check. Send a valid protocol request, authenticate where required, and confirm that the expected response arrives.

After starting the tunnel, repeat the same application-level test from a separate external network using the assigned public host and port. A generic connection probe can show whether TCP opens, but it cannot prove that the application protocol is healthy. TLS-based services should also be checked for the expected certificate, hostname handling, and protocol negotiation.

nc -vz PUBLIC_HOST PUBLIC_PORT

This is a generic example for systems with a compatible Netcat implementation. Replace the placeholders with the values assigned to the tunnel. Netcat options vary across operating systems, so use the platform's equivalent connection tester where necessary.

Verify UDP locally and publicly

UDP verification must be protocol-aware because UDP has no connection handshake. A generic sender may report success merely because the local operating system accepted a datagram for transmission. That result does not prove that the remote application received it, processed it, or replied.

Use the service's native client to send a valid request and confirm an expected response, state change, log entry, or packet capture. Test locally first, then test the public endpoint from another network. If the protocol is intentionally one-way, use receiver logs or a packet capture to confirm arrival. Do not treat the absence of an immediate socket error as proof of delivery.

Verify combined UDP/TCP services

Test TCP and UDP independently. A successful TCP connection does not verify the UDP path, and a UDP response does not verify the TCP listener. Confirm that both local listeners use the same intended address and port before attributing a failure to the tunnel.

Symptom Likely checks Corrective action
Public endpoint refuses or times out Client connection, tunnel running state, relay selection, local listener Reconnect the selected client, start the tunnel, and verify the local service independently.
TCP opens but the application fails Protocol framing, TLS expectations, authentication, application logs Test with the native client and confirm that the public client uses the expected protocol.
UDP test produces no reply Whether the protocol replies, packet arrival, host firewall, target port Send a valid protocol request and inspect receiver logs or captures instead of relying on a connection probe.
UDP messages arrive incomplete Receive-buffer size, truncation indicators, application message limits Use an adequate buffer, inspect the API's truncation signal, and reject incomplete datagrams.
Local test works only on the service host Bind address, host firewall, route from the Localtonet device Use an intentionally reachable local interface and restrict access appropriately.
Combined tunnel works for one transport Separate TCP and UDP listeners on the same target port Confirm both listeners exist. If the service uses different ports, use matching separate configurations.
Service stops after previously working Application process, Localtonet client, tunnel state, local address changes Restore the failed component and recheck the current target rather than assuming the saved configuration is active.
Linux client does not reconnect after an upgrade Package prerequisites, service state, token file permissions, journal output Run the configuration check, restart localtonet.service, and inspect its journal without publishing credentials.

Routine operation

Keep the application, Localtonet client, and tunnel under intentional operational control. Monitor the application's own logs for authentication failures, malformed requests, resource exhaustion, and unexpected clients. If the local target changes after a restart or network reconfiguration, update the tunnel target and verify it again.

Stop tunnels when a maintenance task, demonstration, or test ends. Deleting an unused configuration reduces the chance that someone later starts an obsolete endpoint pointing at the wrong service. If a device token might have been disclosed, treat it as a credential incident and replace or revoke it through the current account workflow.

Security guidance for public TCP and UDP exposure

A public host and port can be discovered, scanned, and tested by arbitrary internet clients. A tunnel changes reachability, not the security model of the application behind it. Raw TCP and UDP services do not automatically gain user authentication or application-level encryption merely because they are tunneled.

Do not expose administrative services casually

SSH, databases, Android Debug Bridge, router interfaces, remote desktops, orchestration APIs, DNS resolvers, and other administrative services can provide powerful access if misconfigured or compromised. Prefer private access designs for administration. If public exposure is necessary, use strong protocol authentication, encryption, least-privilege accounts, current software, and IP restrictions or equivalent controls where available.

🔐 Require authentication Disable anonymous or default access. Prefer strong keys or modern authentication mechanisms supported by the application.
🛡️ Encrypt sensitive protocols Use TLS, SSH, DTLS, QUIC, or another protocol-appropriate secure layer. Transport checksums do not protect confidentiality or authenticate peers.
👤 Apply least privilege Use restricted accounts, limited database roles, narrow file permissions, and service identities that cannot administer the entire host.
🚧 Restrict who can connect Use IP restrictions or application access controls where available. An uncommon port or undisclosed hostname is not access control.
🧱 Minimize the exposed surface Publish only the required transport and port. Keep management interfaces, debug endpoints, and unrelated listeners private.
📋 Log and review activity Use application logs and host monitoring to identify failed authentication, abuse, malformed payloads, and resource pressure.

Special risks for UDP services

A publicly reachable UDP service can be abused if it sends a response much larger than an unauthenticated request, particularly when attackers can spoof source addresses elsewhere in the path. DNS and other request-response services require careful anti-abuse configuration. Avoid exposing an unrestricted recursive resolver or another reflection-capable service.

UDP applications also need resource controls. Rate limiting, validation, bounded queues, conservative message sizes, and congestion-aware sending help reduce accidental overload and malicious packet floods. Authenticate messages when the protocol supports it and reject malformed input before allocating expensive resources.

Protect the Localtonet device token

A Localtonet authentication token identifies the client device that can run a tunnel. Do not place it in a repository, container image, screenshot, chat message, shell example, or published tutorial. On packaged Linux installations, keep the documented token file restricted to mode 600. If a token is exposed, rotate or revoke it instead of relying on deletion from one visible location.

Frequently asked questions

What is the main difference between TCP and UDP?

TCP provides a reliable, ordered byte stream with retransmission, flow control, and congestion control. UDP carries separate datagrams without built-in recovery, ordering, duplicate suppression, flow control, or congestion control. UDP preserves message boundaries, while TCP does not.

Does TCP guarantee that every packet arrives?

No. Individual IP packets can be lost, duplicated, or reordered. TCP retransmits missing stream data and presents successfully received bytes in order. If recovery becomes impossible because of a failure, reset, or timeout, the connection can terminate before all intended application data is delivered.

Is UDP always faster than TCP?

No. UDP has less base transport machinery and no TCP-style handshake, but performance depends on the workload, network, implementation, security layer, recovery strategy, and congestion behavior. TCP can be highly efficient for reliable bulk transfer.

Can a UDP receive operation return only part of a datagram?

If the supplied receive buffer is too small, a socket API can copy only the portion that fits and discard the excess bytes. The API may provide a truncation flag, original length, copied length, or error depending on the platform. The discarded remainder is not normally returned by the next receive call.

Does DNS use TCP or UDP?

DNS uses several transports. Conventional queries commonly use UDP with EDNS advertising supported payload sizes. A resolver can retry a truncated response over TCP, and conventional full zone transfers use TCP. DoT uses TLS, DoH uses HTTP over its negotiated transport, and DoQ uses QUIC over UDP.

Is QUIC the same as HTTP/3?

No. QUIC is a secure multiplexed transport protocol standardized in RFC 9000. HTTP/3 is the mapping of HTTP semantics onto QUIC and is standardized separately in RFC 9114. Other application protocols can also use QUIC.

Can Localtonet tunnel both TCP and UDP?

Yes. Our documented tunnel categories include TCP, UDP, and combined UDP/TCP. Choose the type that matches the local service. Use a combined configuration only when both transports target the same local IP address and port.

Why can a UDP test report success when the server receives nothing?

UDP has no connection handshake. A sending tool may confirm only that the local operating system accepted a datagram. Verify delivery with a valid application request and an expected reply, receiver log, state change, or packet capture. Test the local target before testing the public endpoint.

Does creating a Localtonet tunnel make it immediately available?

No. Creation saves the configuration. You must start the tunnel, and the selected Localtonet client must remain connected. Stop the tunnel when access is no longer needed, or delete it if the configuration will not be reused.

What does the packaged Linux client require?

The current DEB and RPM packages are available for x64 and ARM64 and require systemd 247 or newer plus OpenSSL 3. After installation, protect the authentication-token file with mode 600, run the configuration check, start localtonet.service, and inspect its systemd journal.

Publish the transport your application actually uses

Run and verify your local service, install the current Localtonet client, then create a TCP, UDP, or combined UDP/TCP tunnel that matches the real listener configuration. Start it only after authentication and access controls are ready, test the assigned public endpoint, and stop or delete the tunnel when the work is complete.

Get Started Free →

Corrections & updates

Substantive changes approved by the Localtonet editorial team are listed transparently below.

Rename the article to identify TCP and UDP accurately as transport protocols. Remove the outer article wrapper and move the lead figure so the body begins with the hero followed immediately by the clickable guide navigation. Preserve all working fragment links. Expand prerequisites and installation into a self-contained overview of currently supported client platforms, then include the verified DEB and RPM prerequisites, authentication-token file protection, configuration check, systemd startup, log inspection, and upgrade restart pro

Add the required hero-adjacent clickable guide navigation with valid fragment targets; convert all primary headings to identified h2 lt-section-title elements; remove inline styles and unsupported classes; fix heading hierarchy and avoid duplicating the page title in the hero; update TCP from RFC 793 to RFC 9293 and clarify byte-stream reliability, acknowledgments, checksums, teardown, congestion control, and head-of-line blocking; qualify UDP performance and checksum behavior; modernize DNS coverage for EDNS, truncation, TCP, DoT, Do

Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.

support