nalchi
Loading...
Searching...
No Matches
nalchi::socket_extensions Class Reference

Extensions for ISteamNetworkingSockets. More...

#include <nalchi/socket_extensions.hpp>

Static Public Member Functions

static void unicast (ISteamNetworkingSockets *sockets, HSteamNetConnection connection, nalchi::shared_payload payload, int logical_bytes_length, int send_flags, std::int64_t *out_message_number_or_result, std::uint16_t lane=0, std::int64_t user_data=0)
 Unicasts a shared_payload to a connection.
 
template<typed_input_range< HSteamNetConnection > ConnectionRange>
static void multicast (ISteamNetworkingSockets *sockets, ConnectionRange &&connections, nalchi::shared_payload payload, int logical_bytes_length, int send_flags, std::span< std::int64_t > out_message_number_or_result, std::uint16_t lane=0, std::int64_t user_data=0)
 Multicasts a shared_payload to the connections.
 
static void multicast (ISteamNetworkingSockets *sockets, unsigned connections_count, const HSteamNetConnection *connections, nalchi::shared_payload payload, int logical_bytes_length, int send_flags, std::int64_t *out_message_number_or_result, std::uint16_t lane=0, std::int64_t user_data=0)
 Multicasts a shared_payload to the connections.
 

Detailed Description

Extensions for ISteamNetworkingSockets.

Member Function Documentation

◆ multicast() [1/2]

template<typed_input_range< HSteamNetConnection > ConnectionRange>
static void nalchi::socket_extensions::multicast ( ISteamNetworkingSockets * sockets,
ConnectionRange && connections,
nalchi::shared_payload payload,
int logical_bytes_length,
int send_flags,
std::span< std::int64_t > out_message_number_or_result,
std::uint16_t lane = 0,
std::int64_t user_data = 0 )
inlinestatic

Multicasts a shared_payload to the connections.

This function uses ISteamNetworkingSockets::SendMessages() under the hood, but it shares the payload between them.
So, it's more efficient if you send a same message to a lot of connections with this.

Template Parameters
ConnectionRangeConnection range type that can take any iterable range of HSteamNetConnection.
Parameters
connectionsConnections to multicast to.
payloadPayload to send.
logical_bytes_lengthLogical number of bytes of the payload.
send_flagsSend flags. See message sending flags on the Steamworks docs.
out_message_number_or_resultOptional pointer to receive the message number if successful, or a negative EResult value if failed.
laneOptional lane index. See ISteamNetworkingSockets::ConfigureConnectionLanes for details.
user_dataOptional user data.

◆ multicast() [2/2]

static void nalchi::socket_extensions::multicast ( ISteamNetworkingSockets * sockets,
unsigned connections_count,
const HSteamNetConnection * connections,
nalchi::shared_payload payload,
int logical_bytes_length,
int send_flags,
std::int64_t * out_message_number_or_result,
std::uint16_t lane = 0,
std::int64_t user_data = 0 )
static

Multicasts a shared_payload to the connections.

This function uses ISteamNetworkingSockets::SendMessages() under the hood, but it shares the payload between them.
So, it's more efficient if you send a same message to a lot of connections with this.

Parameters
connections_countNumber of connections.
connectionsConnections to multicast to.
payloadPayload to send.
logical_bytes_lengthLogical number of bytes of the payload.
send_flagsSend flags. See message sending flags on the Steamworks docs.
out_message_number_or_resultOptional pointer to receive the message number if successful, or a negative EResult value if failed.
laneOptional lane index. See ISteamNetworkingSockets::ConfigureConnectionLanes for details.
user_dataOptional user data.

◆ unicast()

static void nalchi::socket_extensions::unicast ( ISteamNetworkingSockets * sockets,
HSteamNetConnection connection,
nalchi::shared_payload payload,
int logical_bytes_length,
int send_flags,
std::int64_t * out_message_number_or_result,
std::uint16_t lane = 0,
std::int64_t user_data = 0 )
static

Unicasts a shared_payload to a connection.

This function is pretty similar to the ISteamNetworkingSockets::SendMessageToConnection(), but it's for the nalchi::shared_payload.
But, it uses ISteamNetworkingSockets::SendMessages() under the hood, so the result is returns with out_message_number_or_result instead of a return value.

Parameters
connectionConnection to send to.
payloadPayload to send.
logical_bytes_lengthLogical number of bytes of the payload.
send_flagsSend flags. See message sending flags on the Steamworks docs.
out_message_number_or_resultOptional pointer to receive the message number if successful, or a negative EResult value if failed.
laneOptional lane index. See ISteamNetworkingSockets::ConfigureConnectionLanes for details.
user_dataOptional user data.

The documentation for this class was generated from the following file: