Skip to content
Latchkey

What Is a Port? Numbered Endpoints for Network Services

A port is a numeric identifier that, together with an IP address, pinpoints a specific service on a host so the operating system can route traffic to the right process.

One server can run many services at once, so it needs a way to send each connection to the right one. Ports do that: a process listens on a port number, and clients connect to that number. CI service containers, local test servers, and deploy targets all bind to ports, and port mismatches are a common cause of "connection refused" in pipelines.

Address plus port

An IP address finds the host; the port finds the service on it. The pair fully identifies one endpoint of a connection, so two services on the same host simply use different ports.

Well-known ports

  • 80 for HTTP and 443 for HTTPS.
  • 22 for SSH.
  • 5432 for PostgreSQL, 3306 for MySQL.
  • 6379 for Redis.

Listening and binding

A service binds to a port to accept connections. If another process already holds that port, binding fails with "address already in use", a frequent error when a test server did not shut down cleanly.

Ports in CI service containers

When CI spins up a database or cache as a service container, the job connects to it on a known port. Misconfiguring that port, or connecting before the service is listening, produces connection refused errors.

Ports in deployments

Containers expose ports that load balancers and proxies map to public ports. A deploy that maps the wrong container port sends traffic nowhere, surfacing as failed health checks or 502s.

Timing versus configuration

Connecting before a service has bound its port is a timing issue that a brief wait or retry fixes; connecting to the wrong port is a configuration bug. Latchkey runners retry the transient "not listening yet" case to common services so startup races do not fail a job.

Key takeaways

  • A port number plus an IP address identifies a specific service on a host.
  • Binding fails if a port is already in use, and clients fail if they target the wrong port.
  • A startup race on a port is retryable; a wrong port number is a configuration bug.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →