> For the complete documentation index, see [llms.txt](https://krjaeh0.gitbook.io/j-log/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://krjaeh0.gitbook.io/j-log/network/protocols/port.md).

# Port

* 항구라는 의미에서 착안
* 클라이언트가 서버의 포트에 접근하여 데이터를 내려놓고, 서버가 클라이언트에 보낼 데이터를 실어 돌려보내는 일련의 과정이 항구에서 일어나는 물류 과정과 유사하여 붙여진 이름
* 포트로 데이터를 교환하는 방식은 [전송 계층 프로토콜(Transport Layer Protocol)](broken://pages/0d3dc161486b52f8a5202aeb52caf77754865325)을 따른다.

## 포트 수와 범위

* 포트의 개수는 운영체제에서 정의하기 나름
  * 윈도우/리눅스/맥에서 0\~65535번까지, 총 65536개의 네트워크 포트를 사용

## 잘 알려진 포트 (Well-known / Privileged ports)

* 포트 0\~1023은 잘 알려진 포트(Well-known port) 또는 특권 포트(Privileged port)라고 한다.
  * 각 포트에 유명한 서비스가 등록되어 있다.
  * 예: 22 = SSH, 80 = HTTP, 443 = HTTPS
  * 잘 알려진 포트에 서비스를 실행하려면 관리자 권한이 필요하다.
  * 따라서 클라이언트는 이 대역에서 실행 중인 서비스들은 관리자의 것이라 신뢰할 수 있게 된다.

{% hint style="info" %}
포트 번호 예시는 문서에 따라 다를 수 있으므로, 필요한 경우 각 서비스의 공식 문서를 참고하세요.
{% endhint %}

### Network port vs Service port

* **Network port**: 프로세스(프로그램)를 식별하는 논리적 번호.
* **Service port**: 그중 “특정 서비스가 점유”하는 포트(예: HTTP = 80/TCP).

### 전송 계층 프로토콜과 함께 본다

같은 번호라도 `TCP/80` 과 `UDP/80` 은 다른 소켓입니다.\
`TCP` 로 열어놓은 서비스는 `UDP` 로 접근해도 통신이 안 됩니다.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://krjaeh0.gitbook.io/j-log/network/protocols/port.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
