Accept an incoming connection that has been received on a listen socket.
Begin asynchronous process of allocating a fake IPv4 address that other peers can use to contact us via P2P. IP addresses returned by this function are globally unique for a given appid.
Disconnects from the remote host and invalidates the connection handle. Any unread data on the connection is discarded.
Destroy a listen socket. All the connections that were accepting on the listen socket are closed ungracefully.
Creates a connection and begins talking to a "server" over UDP at the given IPv4 or IPv6 address. The remote host must be listening with a matching call to CreateListenSocketIP on the specified port.
Begin connecting to a peer that is identified using a platform-specific identifier. This uses the default rendezvous service, which depends on the platform and library configuration. (E.g. on Steam, it goes through the steam backend.)
Create a P2P "client" connection that does signaling over a custom rendezvous/signaling channel.
Client call to connect to a server hosted in a Valve data center, on the specified virtual port. You must have placed a ticket for this server into the cache, or else this connect attempt will fail! If you are not issuing your own tickets, then to connect to a dedicated server via SDR in auto-ticket mode, use ConnectP2P. (The server must be configured to allow this type of connection by listening using CreateListenSocketP2P.)
Get an interface that can be used like a UDP port to send/receive datagrams to a FakeIP address. This is intended to make it easy to port existing UDP-based code to take advantage of SDR.
Create a listen socket on the specified virtual port. The physical UDP port to use will be determined by the SDR_LISTEN_PORT environment variable. If a UDP port is not configured, this call will fail.
Creates a "server" socket that listens for clients to connect to by calling ConnectByIPAddress, over ordinary UDP (IPv4 or IPv6)
Like CreateListenSocketIP, but clients will connect using ConnectP2P.
Create a listen socket that will listen for P2P connections sent to our FakeIP. A peer can initiate connections to this listen socket by calling ConnectByIPAddress.
Create a new poll group.
Create a pair of connections that are talking to each other, e.g. a loopback connection. This is very useful for testing, or so that your client/server code can work the same even when you are running a local "server".
Destroy a poll group created with CreatePollGroup().
Search cache for a ticket to talk to the server on the specified virtual port. If found, returns the number of seconds until the ticket expires, and optionally the complete cracked ticket. Returns 0 if we don't have a ticket.
Flush any messages waiting on the Nagle timer and send them at the next transmission opportunity (often that means right now).
Query our readiness to participate in authenticated communications. A SteamNetAuthenticationStatus_t callback is posted any time this status changes, but you can use this function to query it at any time.
Get blob that describes a certificate request. You can send this to your game coordinator. Upon entry, *pcbBlob should contain the size of the buffer. On successful exit, it will return the number of bytes that were populated. You can pass pBlob=NULL to query for the required size. (512 bytes is a conservative estimate.)
Returns basic information about the high-level state of the connection.
Fetch connection name. Returns false if handle is invalid
Fetch connection user data. Returns -1 if handle is invalid or if you haven't set any userdata on the connection.
Returns detailed connection stats in text format. Useful for dumping to a log, etc.
Return info about the FakeIP and port(s) that we have been assigned, if any. idxFirstPort is currently reserved and must be zero. Make sure and check SteamNetworkingFakeIPResult_t::m_eResult
Generate an authentication blob that can be used to securely login with your backend, using SteamDatagram_ParseHostedServerLogin. (See steamdatagram_gamecoordinator.h)
Return info about the hosted server. This contains the PoPID of the server, and opaque routing information that can be used by the relays to send traffic to your server.
Returns 0 if SDR_LISTEN_PORT is not set. Otherwise, returns the data center the server is running in. This will be k_SteamDatagramPOPID_dev in non-production environment.
Returns the value of the SDR_LISTEN_PORT environment variable. This is the UDP server your server will be listening on. This will configured automatically for you in production environments.
Configure multiple outbound messages streams ("lanes") on a connection, and control head-of-line blocking between them. Messages within a given lane are always sent in the order they are queued, but messages from different lanes may be sent out of order. Each lane has its own message number sequence. The first message sent on each lane will be assigned the number 1.
Returns local IP and port that a listen socket created using CreateListenSocketIP is bound to.
Returns a small set of information about the real-time state of the connection Returns false if the connection handle is invalid, or the connection has ended.
If the connection was initiated using the "FakeIP" system, then we we can get an IP address for the remote host. If the remote host had a global FakeIP at the time the connection was established, this function will return that global IP. Otherwise, a FakeIP that is unique locally will be allocated from the local FakeIP address space, and that will be returned.
Indicate our desire to be ready participate in authenticated communications. If we are currently not ready, then steps will be taken to obtain the necessary certificates. (This includes a certificate for us, as well as any CA certificates needed to authenticate peers.)
Fetch the next available message(s) from the connection, if any. Returns the number of messages returned into your array, up to nMaxMessages. If the connection handle is invalid, -1 is returned.
Same as ReceiveMessagesOnConnection, but will return the next messages available on any connection in the poll group. Examine SteamNetworkingMessage_t::m_conn to know which connection. (SteamNetworkingMessage_t::m_nConnUserData might also be useful.)
Called when custom signaling has received a message. When your signaling channel receives a message, it should save off whatever routing information was in the envelope into the context object, and then pass the payload to this function.
Call this when you receive a ticket from your backend / matchmaking system. Puts the ticket into a persistent cache, and optionally returns the parsed ticket.
Reset the identity associated with this instance. Any open connections are closed. Any previous certificates, etc are discarded. You can pass a specific identity that you want to use, or you can pass NULL, in which case the identity will be invalid until you set it using SetCertificate
Invoke all callback functions queued for this interface. See k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, etc
Send a message to the remote host on the specified connection.
Send one or more messages without copying the message payload. This is the most efficient way to send messages. To use this function, you must first allocate a message object using ISteamNetworkingUtils::AllocateMessage. (Do not declare one on the stack or allocate your own.)
Set the certificate. The certificate blob should be the output of SteamDatagram_CreateCert.
Set a name for the connection, used mostly for debugging
Assign a connection to a poll group. Note that a connection may only belong to a single poll group. Adding a connection to a poll group implicitly removes it from any other poll group it is in.
Set connection user data. the data is returned in the following places - You can query it using GetConnectionUserData. - The SteamNetworkingmessage_t structure. - The SteamNetConnectionInfo_t structure. (Which is a member of SteamNetConnectionStatusChangedCallback_t -- but see WARNINGS below!!!!)
Lower level networking API.
- Connection-oriented API (like TCP, not UDP). When sending and receiving messages, a connection handle is used. (For a UDP-style interface, where the peer is identified by their address with each send/recv call, see ISteamNetworkingMessages.) The typical pattern is for a "server" to "listen" on a "listen socket." A "client" will "connect" to the server, and the server will "accept" the connection. If you have a symmetric situation where either peer may initiate the connection and server/client roles are not clearly defined, check out k_ESteamNetworkingConfig_SymmetricConnect. - But unlike TCP, it's message-oriented, not stream-oriented. - Mix of reliable and unreliable messages - Fragmentation and reassembly - Supports connectivity over plain UDP - Also supports SDR ("Steam Datagram Relay") connections, which are addressed by the identity of the peer. There is a "P2P" use case and a "hosted dedicated server" use case.
Note that neither of the terms "connection" nor "socket" necessarily correspond one-to-one with an underlying UDP socket. An attempt has been made to keep the semantics as similar to the standard socket model when appropriate, but some deviations do exist.
See also: ISteamNetworkingMessages, the UDP-style interface. This API might be easier to use, especially when porting existing UDP code.