A small native core for a direct connection

cadb.

Lightweight C11 client library for talking directly to adbd over TCP.

  • Pure C11
  • Zero adb server
  • CMake
  • MIT License

Current release v0.2.1 C ABI No runtime dependency

connection.c READY
01cadb_net_create(&net);
02cadb_net_connect(net, &device);
03cadb_connect(session);
04cadb_exec_shell_v2(session, ...);
TCP session establishedadbd :5555

01 / Architecture

Keep the connection in process.

Use the same ADB protocol, with a smaller deployment path: your program links cadb and opens a TCP connection to the device.

A

Without cadb

process boundary
Your
program
adb
binary
adb
server
ADB
device

A command-line tool and a host-side service sit between your application and the device.

B

With cadb

direct TCP
Your program
+ cadb
TCP
custom TLS
adbd
on device

One native library owns framing and ADB sessions; your app owns discovery, keys, and transport policy.

01

No adb binary or server

Connect to adbd directly. No platform-tools install or always-on host daemon.

02

Small native surface

Pure C11 and a C ABI make cadb straightforward to link from mobile, desktop, and embedded code.

03

MIT licensed

Use the library in open or closed source applications while retaining its MIT notice.

02 / Comparison

Choose the layer you need.

These projects solve related but different integration problems. The right fit depends on your host runtime and whether you need the ADB host server.

ProjectLanguage / runtimeHost adb serverNative embed profileLicense
cadb THIS PROJECTC11 / nativeNo — direct to adbdHigh — C ABI, no language runtimeMIT
dadb Kotlin / Java · JVMNo — direct connectionHigh for JVM appsApache-2.0
goadb Go runtimeYes — host-server clientMedium — Go toolchain/runtimeApache-2.0
pure-python-adb Python interpreterYes — host-server clientLow for native-only appsMIT

Comparison reflects each project's documented connection model and primary runtime; embed profile is a practical, qualitative fit rather than a benchmark.

03 / Scope

Small core. Clear boundaries.

cadb handles the ADB client session and leaves platform-specific policy where it belongs: in the host application.

Core scope

  • TCP connection to device adbd
  • ADB framing, CNXN negotiation, and callback AUTH
  • Remote shell, including Shell v2 exit status
  • SYNC push and APK install tasks
  • Explicit error codes, timeout, and cancellation APIs

Explicit non-goals

  • No host-side adb server or daemon manager
  • No USB transport or bundled platform-tools
  • No built-in key store, RSA private key, or TLS policy
  • No mDNS discovery or wireless pairing UI
  • No heavy runtime or language-specific framework

For wireless debugging, use your platform APIs for discovery, pairing, and key storage, then provide cadb's auth callbacks and TLS-capable transport.

04 / Ecosystem

A native layer for real tools.

Use cadb where a product needs device communication without shipping a separate host ADB service.

01

Mobile & TV companions

Link the C core from Swift, Kotlin/JNI, or another native host.

iOS / Android
02

Device management tools

Build focused installers, shell controls, and fleet utilities.

Desktop
03

Language bridges

Start from the examples for Rust, Python, Flutter, and more.

C ABI / FFI

Ready to connect?

Start with the public C API.

Read the API reference