#sockets #networking #syscalls #io #api-bindings

socket2

Utilities for handling networking sockets with a maximal amount of configuration possible intended

32 releases

0.5.8 Nov 28, 2024
0.5.7 Apr 29, 2024
0.5.6 Feb 23, 2024
0.5.5 Oct 20, 2023
0.2.1 Jun 13, 2017

#3 in Network programming

Download history 2790524/week @ 2024-08-21 2645308/week @ 2024-08-28 2887679/week @ 2024-09-04 2677808/week @ 2024-09-11 2745302/week @ 2024-09-18 2957733/week @ 2024-09-25 3304830/week @ 2024-10-02 3348004/week @ 2024-10-09 3481409/week @ 2024-10-16 2958800/week @ 2024-10-23 2766135/week @ 2024-10-30 2726415/week @ 2024-11-06 2834954/week @ 2024-11-13 2774551/week @ 2024-11-20 2519643/week @ 2024-11-27 2457859/week @ 2024-12-04

11,088,306 downloads per month
Used in 24,539 crates (429 directly)

MIT/Apache

275KB
5.5K SLoC

Socket2

Socket2 is a crate that provides utilities for creating and using sockets.

The goal of this crate is to create and use a socket using advanced configuration options (those that are not available in the types in the standard library) without using any unsafe code.

This crate provides as direct as possible access to the system's functionality for sockets, this means little effort to provide cross-platform utilities. It is up to the user to know how to use sockets when using this crate. If you don't know how to create a socket using libc/system calls then this crate is not for you. Most, if not all, functions directly relate to the equivalent system call with no error handling applied, so no handling errors such as EINTR. As a result using this crate can be a little wordy, but it should give you maximal flexibility over configuration of sockets.

See the API documentation for more.

Branches

Currently Socket2 supports two versions: v0.5 and v0.4. Version 0.5 is being developed in the master branch. Version 0.4 is developed in the v0.4.x branch branch.

OS support

Socket2 attempts to support the same OS/architectures as Rust does, see https://doc.rust-lang.org/nightly/rustc/platform-support.html. However this is not always possible, below is current list of support OSs.

If your favorite OS is not on the list consider contributing it! See issue #78.

Tier 1

These OSs are tested with each commit in the CI and must always pass the tests. All functions/types/etc., excluding ones behind the all feature, must work on these OSs.

  • Linux
  • macOS
  • Windows

Tier 2

These OSs are currently build in the CI, but not tested. Not all functions/types/etc. may work on these OSs, even ones not behind the all feature flag.

  • Android
  • FreeBSD
  • Fuchsia
  • iOS
  • illumos
  • NetBSD
  • Redox
  • Solaris

Minimum Supported Rust Version (MSRV)

Socket2 uses 1.63.0 as MSRV.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0–8MB
~64K SLoC