Swiftnet

Swiftnet

GitHub: Morcules/SwiftNet

A friendly and small library for sending reliable messages between computers or game players. Built to stay simple while still being efficient.

About

SwiftNet exists so that normal developers (especially people making games or tools) can add networking without going deep into sockets while providing very fast server-side performance and good cpu efficienty (low server cost).

The big goals for this library are simple:

  • Make sending data feel easy. You should not have to think about sockets, headers, or splitting messages yourself.
  • Handle the annoying stuff automatically: big messages get broken into pieces and put back together. If some packets get lost, it handles resending.
  • Use as little CPU and memory, while being fast.
  • Keep many features and customizations compile-time.
  • Provide strong low-level customizations for experienced users (DPDK, memory usage customizations, thread locking time).

Supported Platforms

  • Apple Silicon Macs (macOS arm64)
  • Linux arm64 machines

Use Cases

  • Multiplayer games where you want networking that just works without a giant learning curve.
  • Any program that wants simple, dependable messages and does not want to spend lots of CPU on it.
  • Server software you plan to keep improving for years.

Roadmap

0.5.0 — working on this now
  • Make the busiest parts of the code faster
  • Use smarter memory handling (huge pages and locked memory)
  • Fix a checksum issue
  • Add DPDK support
1.0.0
  • Make the API structure much more stable for the future
  • Optimize DPDK performance
  • Optimize hot loops at assembly level
  • Windows support
Long-term
  • Possible VHDL optimizations

Performance

Tested with one very large message (100 megabytes) sent over real Wi-Fi interface on a normal Mac Air M3 laptop while other programs were running:

  • Finished in roughly 5 seconds.
  • Library CPU time is around 0.07 seconds while backend CPU time (PCAP) is 0.31 seconds

That’s the kind of efficiency we want. Your game or server should spend its energy on players and logic, not on fighting its own networking code.

Installation

With vcpkg

1
vcpkg install morcules-swiftnet

Build it yourself

  1. Get the code and go into the build folder.
  2. Run the release build script.
  3. In your own program: include the header and link the small static library.

One important note: you usually need to run the program with sudo because it uses low-level network access.

Contributing

Any help is welcome — even tiny fixes or questions.

Start with the issues marked “good first issue” or “help wanted”. For bigger ideas, chat in an issue first.

We prefer draft pull requests so that the automatic checks can run early.

Quick rule: feel free to use any AI tools to help, but understand the code and test it on your machine before submitting a PR.

License

This project is licensed under the Apache License 2.0.