मुख्य सामग्री पर जाएँ
Skillpedia
API और सर्वर (backend)29k · #9544

boost-asio-pro

यह क्या करती है

यह स्किल एजेंट को Boost.Asio या स्टैंडअलोन Asio से async C++ नेटवर्किंग कोड लिखने में मार्गदर्शन देती है। यह उन C++ डेवलपर्स के लिए है जो TCP, UDP या SSL सर्वर और क्लाइंट बनाते हैं और मुश्किल से पकड़ में आने वाले क्रैश से बचना चाहते हैं।

कब इस्तेमाल करें

  • ✓जब आप Boost.Asio के साथ C++ में async नेटवर्किंग कोड लिख रहे हों।
  • ✓जब आप C++ नेटवर्किंग कोड में lifetime या threading बग के लिए समीक्षा कर रहे हों।
  • ✓जब आपको Asio कोड को पुराने या नए Boost वर्ज़न के अनुरूप करना हो।

Skill का लिंक

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/boost-asio-pro/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/boost-asio-pro/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“हमारे पुराने Boost वर्ज़न के साथ चलने वाला Boost.Asio में एक सरल C++ TCP echo सर्वर लिखिए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट पहले आपका Boost वर्ज़न और C++ मानक जाँचता है, फिर मेल खाती शैली चुनता है, जैसे नए टूलचेन के लिए coroutines या पुराने के लिए callbacks। वह object lifetimes, strands और cancellation के नियम लागू करता है।

तकनीकी सामग्री (मूल 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

Use this skill whenever async C++ networking code is being written or reviewed — and especially when the target toolchain is old, where coroutine examples simply will not compile. The three worked implementations it references are CI-verified from Boost 1.62 (2016) through 1.90.

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.

Buffers do not own memory. asio::buffer() is a view. Storage must outlive the operation: coroutine locals are fine across co_await in the same frame; in callback style the same data must become a member, not a local.

Connections must outlive their handlers. enable_shared_from_this, and capture self in every co_spawn / handler — read loop, write loop, and each timer.

Frame with composed reads. async_read (fills the buffer exactly) for a length prefix and then the body; never async_read_some, which returns short.

Wrap as_tuple. Always as_tuple(use_awaitable). Bare as_tuple resolves against the operation's default token and compiles in some contexts, fails in others.

async_accept(make_strand(...)) changes two things: it forces a

अक्सर पूछे जाने वाले सवाल

Boost वर्ज़न क्यों मायने रखता है?

Asio का API समय के साथ बदला है, और coroutine के उदाहरण पुराने टूलचेन पर कंपाइल नहीं होंगे।

कौन सी शैलियाँ समर्थित हैं?

C++20 सेटअप के लिए coroutines, और पुराने या C++11 से C++17 वाले प्रोजेक्ट के लिए completion handlers।

यह किस तरह के बग से बचने में मदद करती है?

lifetime समस्याओं और छूटे cancellations जैसे क्लासिक async बग।

जानकारी

लेखक का मूल विवरण

Use for any C++ networking code with Boost.Asio or standalone Asio (TCP/UDP, SSL, timers, strands, io_context, co_spawn, awaitable, completion handlers), before writing or reviewing it. Applies lifetime, strand and cancellation rules that avoid the classic async bugs.

repo: alirezarezvani/claude-skills

लोकप्रियता

GitHub स्टार
29k
रैंकिंग में स्थान
#9544
लाइसेंस
MIT
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

agent-launcher-orchestrator

29k

आपके एजेंट को एक साफ़ लक्ष्य से शुरू करके, अपने खाते में Claude मैनेज्ड एजेंट की योजना बनाने, बनाने, जांचने और शेड्यूल करने में चरण-दर-चरण मदद करती है।

AI और एजेंटएजेंट

grade-iterate

29k

आपके एजेंट को किसी मैनेज्ड AI एजेंट के काम को रूब्रिक से आंकने और तय संख्या के दौरों में सुधारने देती है, ताकि वह कभी अनंत चक्र में न फंसे।

AI और एजेंटएजेंट

interview

29k

आपके एजेंट को AI एजेंट के विचार पर आपसे इंटरव्यू लेने और कुछ भी लॉन्च होने से पहले आपके जवाबों को सरल निर्माण योजना में बदलने देती है।

AI और एजेंटएजेंट

run-without-you

29k

आपके एजेंट को मैनेज्ड AI एजेंट शेड्यूल पर या किसी घटना पर चलाने में मदद करती है, लॉन्च से पहले cron समय की जांच के साथ।

प्रोडक्टिविटीऑटोमेशन

मिलती-जुलती skills