networking

Implement, migrate, and debug Apple Network.framework connections for iOS 12-26.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/derKlinke/codex-config --skill networking-derklinke
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: networking
Source: https://github.com/derKlinke/codex-config/tree/main/skills/ios-networking
Command: npx skills add https://github.com/derKlinke/codex-config --skill networking-derklinke

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill guides developers through modern Network.framework networking basics, migrations, and anti-patterns to build robust, safe network code on iOS 12-26+.

Core Features & Use Cases

  • Guidance on choosing between NWConnection (iOS 12-25) and NetworkConnection (iOS 26+) for TCP/UDP, TLS, and custom protocols.
  • Practical migration patterns from legacy APIs ( BSD sockets, NSStream) to modern, non-blocking networking with proper state handling and error management.
  • Best practices for avoiding common pitfalls (waiting vs ready states, proper memory management, and avoiding reachability races).

Quick Start

Use this skill to design a secure, async/await network workflow that starts a TLS TCP connection to a server and handles state transitions gracefully.

Frequently Asked Questions about networking

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate from BSD sockets to Network.framework in iOS?

Migrating from BSD sockets to Network.framework involves adopting non-blocking NWConnection or NetworkConnection APIs with proper state handling and error management. This transition replaces legacy socket logic with modern, async-safe connection patterns for iOS.

What is the difference between NWConnection and NetworkConnection for TCP and UDP?

NWConnection is the established Network.framework API for iOS 12 through 25, while NetworkConnection is the newer API for iOS 26 and later. Both handle TCP and UDP, but NetworkConnection represents the latest evolution for safer networking patterns.

How do I handle TLS and state transitions in a Network.framework connection?

Handling TLS and state transitions requires monitoring NWConnection states like waiting versus ready, avoiding reachability races, and managing memory properly. You must design secure async workflows that gracefully transition through connection states without blocking.

How do I implement TLV framing and Coder protocols with NWConnection?

Implementing TLV framing and Coder protocols with NWConnection involves structuring custom protocol messages into type-length-value formats and conforming to Coder protocols for serialization. This enables structured data exchange over TCP or UDP connections.

What are common Network.framework anti-patterns and reachability races to avoid?

Common Network.framework anti-patterns include confusing waiting and ready states, improper memory management, and triggering reachability races. Avoiding these pitfalls ensures proper state handling and prevents unstable network connections during state transitions.