Network Daemons  «Prev  Next»

Lesson 7 Server processes
Objective Define a listening server process in Linux

Listening Server Processes

A listening server process is a program that waits for incoming network requests by binding to a local IP address and port, then placing a socket into a state where the operating system can deliver connection attempts (TCP) or datagrams (UDP) to it. In practical terms, “listening” means the service is available and prepared to handle inbound traffic on a specific endpoint such as TCP 443 (HTTPS) or TCP 22 (SSH).

This concept sits directly in the TCP/IP protocol suite: IP routes traffic to a host, while the transport layer (TCP/UDP) routes traffic to the correct process using port numbers. Without a listening process, packets may reach the host, but there is no application endpoint to accept them.

What “Listening” Means in TCP vs UDP

The word “listening” is most precise with TCP, because TCP creates a connection. A TCP server process “listens” by opening a socket and placing it in a passive state so that the kernel can complete the connection handshake and queue connection attempts.

With UDP, there is no connection handshake. A UDP service binds to a port and waits for incoming datagrams. Administrators still describe UDP services as “listening,” but what’s really happening is the process is ready to receive datagrams addressed to its port.

How Linux and the Kernel Participate

A listening server process depends on the kernel’s network stack. The kernel receives packets, applies routing and firewall policy, and then delivers traffic to the correct socket based on the destination IP, destination port, and transport protocol.

For a machine to offer a network service, the server process must bind to the service’s port and remain available to handle requests. Modern secure deployments commonly avoid legacy cleartext services (such as Telnet and FTP) in favor of encrypted protocols (SSH, HTTPS, SFTP, and FTPS).

Server Socket Lifecycle (Linux Perspective)

A typical TCP server follows a predictable socket lifecycle. Conceptually, a listening socket acts as a front door. When a client connects, the kernel creates a new connected socket dedicated to that client, while the original socket continues listening for new connections.

socket()  →  bind()  →  listen()  →  accept()
  
  1. socket() creates the endpoint (for example, IPv4/IPv6 + TCP).
  2. bind() associates the socket with a local IP and port (for example, 0.0.0.0:443 or [::]:443).
  3. listen() tells the kernel to queue incoming connection attempts.
  4. accept() returns a new connected socket for a specific client, while the original socket remains in “listening” mode.

This “parent listener / child connection” model explains why a server can handle many clients at once: the listening socket is not used for application reads/writes. Application I/O happens on the accepted (connected) sockets.

Backlog and Connection Queues

When a TCP server calls listen(), it provides a backlog value. This controls how many pending connection requests the kernel can queue if the application cannot accept them immediately.

A backlog is not a limit on total concurrent users. It is a queue depth for connection attempts that have not yet been accepted by the application. On Linux, the effective backlog is also influenced by kernel settings (for example, net.core.somaxconn) and by how quickly the application calls accept().

Listening Processes and System Resources

Even when idle, a listening server process consumes resources: it occupies a process slot, maintains open file descriptors, and holds kernel socket state. On a host that offers many services, each service typically has at least one listener bound to its port.

Modern systems often reduce overhead by using service managers and socket activation (for example, systemd socket units), load balancers, and consolidated front-end services (such as a reverse proxy terminating TLS on port 443 and routing internally).

How to Identify Listening Server Processes

On modern Linux, ss is the standard tool for inspecting listening sockets. You can also use lsof to map ports to processes.

Use ss to list listeners


# List listening TCP/UDP sockets and the owning processes
ss -lntup
  

Use lsof to map a port to a process


# Show what is bound to TCP port 443 (requires privileges on many systems)
sudo lsof -i :443
  

These commands are essential for validating firewall changes, auditing exposed services, and troubleshooting “connection refused” errors (which commonly indicate no listener exists).

Why This Matters for Security

Every listening port is a potential entry point. A core security discipline in Linux administration is to minimize exposed listeners, prefer encrypted protocols, patch services regularly, and monitor unexpected port bindings. In hardened environments, inbound policy is typically “deny by default,” and only required service ports are allowed.

[1] Kernel: The kernel is the core of the Linux operating system. It manages processes, memory, device access, and the network stack that delivers packets to sockets.

SEMrush Software 7 SEMrush Banner 7