We have a few different networking APIs that can be used to send messages between players.
Our newest APIs relay packets through the Valve network by default, which ensures that players and gameservers are protected. It is higher performance and uses a higher-quality reliability layer. It also supports ordinary UDP connectivity. An open-source version is available on github
- ISteamNetworkingMessages is a high level interface for sending messages to arbitrary peers. It is like UDP, in the sense that connection handles are not used. You specify the message recipient each time you send a message, similar to the sendto() socket function. You do not need to select one peer to be the "client" and initiate the connection, and the server does not need to "listen" for client connections or "accept" them. Either peer can send messages immediately. Because it is very similar to UDP, it may be the easiest API to port existing UDP code. However, unlike raw UDP, the API supports messages larger than a single packet, and reliable message delivery. Traffic is relayed through the Valve backbone, or a direct connection may be established when appropriate.
- ISteamNetworkingSockets is a lower-level connection-handle-oriented interface for sending and receiving messages.
- ISteamNetworkingUtils has miscellaneous utilities, including tools for estimating ping times between arbitrary internet hosts.
- steamnetworkingtypes is a header that has many common types and utilities.
- Steam Datagram Relay is a service for relaying your game traffic over the Valve backbone. This prevents IP addresses from being revealed and in many cases improves ping times and connection quality. All P2P connections are automatically relayed over the Valve backbone when appropriate. This document describes what you need to do if you want to use SDR for dedicated server games, to optimize ping times and protect servers from DoS attack.
is an older, deprecated API. If you are using it, consider migrating to a newer API soon, as we may remove this API from the SDK in a future release.
This API works best when used with Emparejamiento y salas de Steam
, depending on the types of packets you could route everything through one player that is acting as the host (typically the lobby owner) or game server, or send everything out directly to each player.
For there are many great articles on various networking topics around the internet. A few recommendations from us:
See the Steamworks API Example Application (SpaceWar)
for an example of using the ISteamNetworkingSockets
for client-server communication.