본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)48k · #4043

boost-asio-pro

하는 일

이 도구는 프로그램을 멈추지 않고 비동기로 작동하는 네트워크용 C++ 코드를 작성하도록 돕습니다. TCP와 UDP 같은 네트워크 연결, SSL/TLS 보안, 타이머, 그리고 서로 기다릴 필요가 없는 다른 작업들을 처리합니다.

사용하는 경우

  • ✓C++ 네트워크 서버나 클라이언트를 만들 때.
  • ✓프로그램을 멈추지 않고 많은 연결을 동시에 처리해야 할 때.
  • ✓Boost.Asio나 Asio 같은 라이브러리로 네트워킹 작업을 할 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/boost-asio-pro/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/boost-asio-pro/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Boost.Asio를 사용해 연결을 기다리는 간단한 C++ TCP 서버를 어떻게 만들 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 사용 중인 Boost/Asio 버전을 확인하고 그 버전의 특정 규칙을 따릅니다. 데이터의 수명이나 비동기 작업을 관리하는 방법처럼, 흔한 오류를 피하기 위한 중요한 세부 사항에 주의를 기울입니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Boost.Asio / standalone Asio

Overview

Write async C++ networking code that compiles on the user's Boost, not the newest one. Asio's API changed shape three times (classic io_service → io_context → C++20 coroutines) and most Asio code on the internet is from the first era, so pick the style from the toolchain first, then follow that style's reference file.

References: Boost.Asio · standalone Asio

Asio's API changed shape three times, so the same task has three correct answers depending on the Boost version in front of you. This skill makes the agent establish that version first, then apply the rules that are genuinely easy to get wrong — strand versus write serialization, buffer and connection lifetime, composed reads for framing — and finally check its own output against a list before calling it done.

When to Use This Skill

  • Use when writing or reviewing async C++ networking code with Boost.Asio or standalone Asio: TCP/UDP servers and clients, SSL/TLS streams, timers, resolvers.
  • Use when the code involves io_context, io_service, co_spawn, awaitable, async_read, async_write, strand, asio::spawn, yield_context, or completion-handler callbacks.
  • Use when the target toolchain is old: an older Boost or a pre-C++20 standard, where coroutine examples will not compile.
  • Use when async code compiles but misbehaves: interleaved writes, dangling buffers, sockets closing early, operation_aborted treated as an error.

Step 1: pick the style (do this before writing code)

Determine the Boost (or Asio) version and the C++ standard actually in use — find_package(Boost) output, dpkg -l libboost-dev, brew info boost, CMAKE_CXX_STANDARD, or ask. Do not assume the newest.

Boost C++ std Style Read
≥ 1.77 C++20 Coroutines (co_await + awaitable<T>) — preferred references/coroutines.md
≥ 1.74 C++11–17 Completion handlers (callbacks) — the portable baseline references/pre-cpp20.md
≥ 1.80 C++11–17 Stackful asio::spawn + yield_context (links Boost.Coroutine — not header-only) references/pre-cpp20.md
1.62–1.65 C++11 Classic io_service / strand.wrap / expires_from_now references/classic-boost.md

SSL/TLS in any style: references/ssl.md. CMake for any style: references/build.md.

io_context, make_strand, bind_executor, steady_timer, signal_set, async_read/async_write/async_read_until, buffers and resolver are library features — identical in the coroutine and callback styles. Only the suspension mechanism differs.

Step 2: version floors (verified by compiling, not from docs)

Reach for one of these and the build breaks on older distros:

Feature Floor
experimental/awaitable_operators.hpp (the || / && operators) Boost ≥ 1.77 / Asio ≥ 1.20
as_tuple completion token Boost ≥ 1.79 / Asio ≥ 1.21
co_composed (custom composed ops) Boost ≥ 1.85 / Asio ≥ 1.30
3-arg asio::spawn(ex, fn, token) Boost ≥ 1.80 (older Boost has only spawn(ex, fn))
any_io_executor (strand<any_io_executor>, tcp::socket's default executor) Boost ≥ 1.74 — the floor for the callback style; below it, use legacy io_context::strand
io_context, make_strand, expires_after Boost ≥ 1.66 — below it, classic io_service

Distro floors that bite: Debian bookworm ships Boost 1.74 (no awaitable_operators.hpp — #include fails outright), Ubuntu 20.04 ships 1.71 (no any_io_executor), Debian 9 ships 1.62.

Language, not library: the chrono literals 250ms / 30s are C++14. For a true C++11 build write std::chrono::milliseconds(250).

Step 3: the rules that are actually easy to get wrong

A strand does not serialize writes. A strand serializes handler execution, not whole composed operations. Two async_writes in flight on the same strand still interleave bytes on the wire. Full-duplex (a read loop plus concurrent pushes/replies) needs a per-connection strand and an outbound queue with an in-flight flag, so at most one async_write exists at a time. This is the single most common wrong answer about Asio.

…

자주 묻는 질문

「비동기」란 무엇인가요?

네트워크 작업이 끝나기를 기다리며 멈춰 있지 않고, 그 동안에도 프로그램이 다른 일을 할 수 있다는 뜻입니다.

Boost.Asio와 Asio의 차이는 무엇인가요?

Boost.Asio는 Boost 라이브러리의 일부이고, Asio(독립형 Asio)는 전체 Boost 없이도 사용할 수 있습니다. 작동 방식은 매우 비슷합니다.

왜 여러 가지 「스타일」이 있나요?

Asio API(사용 방식)는 시간이 지나며 바뀌었습니다. 서로 다른 스타일은 이런 변화에 대응하며, 이전 또는 최신 버전의 C++ 및 Boost와 호환되도록 합니다.

상세 정보

작성자의 원본 설명

Use when writing asynchronous C++ networking code with Boost.Asio or standalone Asio — TCP/UDP servers and clients, SSL/TLS, timers, strands, composed async ops. Covers io_context, co_spawn, awaitable, async_read/async_write, asio::spawn, yield_context, and pre-C++20 callback styles.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#4043
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬