Reliable & unreliable messages over UDP. Robust message fragmentation & reassembly. P2P networking / NAT traversal. Encryption.
GameNetworkingSockets is a basic transport layer for games. The features are:
ISteamNetworkingMessagesis an interface designed to make it easy to port UDP-based code to P2P use cases. (By UDP-based, we mean non-connection-oriented code, where each time you send a packet, you specify the recipient's address.)
What it does not do:
To get an idea of what the API is like, here are a few things to check out:
ISteamNetworkingSocketsis the most important interface.
steamnetworkingtypes.hhas misc types and declarations.
See BUILDING for more information.
The library was written in C++, but there is also a plain C interface to facilitate binding to other languages.
Third party language bindings:
The main interface class is named SteamNetworkingSockets, and many files have "steam" in their name. But Steam is not needed. If you don't make games or aren't on Steam, feel free to use this code for whatever purpose you want.
The reason for "Steam" in the names is that this provides a subset of the functionality of the API with the same name in the Steamworks SDK. Our main reason for releasing this code is so that developers won't have any hesitation coding to the API in the Steamworks SDK. On Steam, you will link against the Steamworks version, and you can get the additional features there (access to the relay network). And on other platforms, you can use this version, which has the same names for everything, the same semantics, the same behavioural quirks. We want you to take maximum advantage of the features in the Steamworks version, and that won't happen if the Steam code is a weird "wart" that's hidden behind
#ifdef STEAM.
The desire to match the Steamworks SDK also explains a somewhat anachronistic coding style and weird directory layout. This project is kept in sync with the Steam code here at Valve. When we extracted the code from the much larger codebase, we had to do some relatively gross hackery. The files in folders named
tier0,
tier1,
vstdlib,
common, etc have especially suffered trauma. Also if you see code that appears to have unnecessary layers of abstraction, it's probably because those layers are needed to support relayed connection types or some part of the Steamworks SDK.
Did you find a security vulnerability? Please inform us responsibly; you may be eligible for a bug bounty. See the security policy for more information.