A TCP packet has a segment for a numerical descriptor which is metaphorically referred to as a port. A lot of networking hardware and software filters based on that packet segment, or directs it to particular software registered as 'listening' for that number.