Functions | Networking Types

Here is a list of all the functions available in the GodotSteam module. The descriptions are pulled from the official Steamworks SDK documentation with modifications made to fit GodotSteam's implementation of the functions. Naturally, any GodotSteam-specific functions will be noted as such.


These networking type functions are all unique to GodotSteam since we cannot work with C++ structs directly in GDscript. These will create networking identities to use with Networking Messages, Networking Sockets, and Networking Utils classes. Much like how it works in a C++ implmentation, the struct must be created (with either addIdentity or addIPAddress then it must be populated with data (Steam ID, IP address, etc).

addIdentity( string reference_name )

  • Create a new network identity struct and store it for use. When this network identity is used in other functions, you will always use the reference_name to use this struct.
  • You will have to set the IP, Steam ID, string, or bytes with other functions below otherwise the identity is invalid.
  • Returns a bool.

addIPAddress( string refrence_name )

  • Add a new IP address struct and store it for use. When this networking IP address is used in other functions, you will always use the reference_name to use this struct.
  • Returns a bool.

clearIPAddress( string reference_name )

  • IP Address - Set everything to zero. E.g. [::]:0.
  • Returns nothing; void.

clearIdentity( string reference_name )

  • Clear a network identity's data.
  • Returns nothing; void.

getGenericBytes( string reference_name )

  • Returns null if not generic bytes type.
  • Returns an int. Returns an uint8.

getGenericString( string reference_name )

  • Returns null if not generic string type.
  • Returns a string.

getIdentities()

  • Get a list of all known network identities.
  • Returns an array of:
    • this_identity (dictionary)
      • reference_name (string)
      • steam_id (int)
      • type (int)
      • reference_name (string)
      • steam_id (uint64_t)
      • type (int)

getIdentityIPAddr( string reference_name )

  • Returns null if we are not an IP address.
  • Returns an int. Returns a uint32.

getIdentitySteamID( string reference_name )

  • Return back a Steam ID32 or 0 if identity is not a Steam ID.
  • Returns an int. Returns a uint32.

getIdentitySteamID64( string reference_name )

  • Returns 0 if identity is not a Steam ID.
  • Returns an int. Returns a uint64_t.

getIPAddresses()

  • Get a list of all IP address structs and their names.
  • Returns an array of:
    • this_address (dictionary)
      • reference_name (string)
      • localhost (bool)
      • ip_address (int)
      • reference_name (string)
      • localhost (bool)
      • ip_address (uint32)

getIPv4( string reference_name )

  • Returns IP in host byte order (e.g. aa.bb.cc.dd as 0xaabbccdd). Returns 0 if IP is not mapped IPv4.
  • Returns an int. Returns a uint32.

getPSNID( string reference_name )

  • Retrieve this identity's Playstation Network ID.
  • Returns an int. Returns a uint64.

getStadiaID( string reference_name )

  • Retrieve this identity's Google Stadia ID.
  • Returns an int. Returns a uint64.

getXboxPairwiseID( string reference_name )

  • Retrieve this identity's XBox pair ID.
  • Returns a string.

isAddressLocalHost( string reference_name )

  • Return true if this identity is localhost. (Either IPv6 ::1, or IPv4 127.0.0.1).
  • Returns a bool.

isIdentityInvalid( string reference_name )

  • Return true if we are the invalid type. Does not make any other validity checks (e.g. is SteamID actually valid).
  • Returns a bool.

isIdentityLocalHost( string reference_name )

  • Return true if this identity is localhost.
  • Returns a bool.

isIPv4( string reference_name )

  • Return true if IP is mapped IPv4.
  • Returns a bool.

isIPv6AllZeros( string reference_name )

  • Return true if the IP is ::0. (Doesn't check port.).
  • Returns a bool.

parseIPAddressString( string reference_name )

  • Parse an IP address and optional port. If a port is not present, it is set to 0. (This means that you cannot tell if a zero port was explicitly specified.).
  • Returns a string.

parseIdentityString( string reference_name )

  • Parse back a string that was generated using ToString. If we don't understand the string, but it looks "reasonable" (it matches the pattern type: and doesn't have any funky characters, etc), then we will return true, and the type is set to k_ESteamNetworkingIdentityType_UnknownType (0). False will only be returned if the string looks invalid.
  • Returns a string.

setGenericBytes( string reference_name, int data ) setGenericBytes( string reference_name, uint8 data )

  • Returns false if invalid size.
  • Returns a bool.

setIdentityIPAddr( string reference_name, string ip_address_name )

  • Set to specified IP:port.
  • Returns a bool.

setIdentityLocalHost( string reference_name )

  • Set to localhost. (We always use IPv6 ::1 for this, not 127.0.0.1).
  • Returns nothing; void.

setIdentitySteamID( string reference_name, int steam_id ) setIdentitySteamID( string reference_name, uint32 steam_id )

  • Set a 32-bit Steam ID.
  • Returns nothing; void.

setIdentitySteamID64( string reference_name, int steam_id ) setIdentitySteamID64( string reference_name, uint64_t steam_id )

  • Takes SteamID as raw 64-bit number.
  • Returns nothing; void.

setGenericString( string reference_name, string this_string )

  • Returns false if invalid length.
  • Returns a bool.

setPSNID( string reference_name, int psn_id ) setPSNID( string reference_name, uint64_t psn_id )

  • Set the Playstation Network ID for this identity.
  • Returns nothing; void.

setStadiaID( string reference_name, int stadia_id ) setStadiaID( string reference_name, uint64_t stadia_id )

  • Set the Google Stadia ID for this identity.
  • Returns nothing; void.

setXboxPairwiseID( string reference_name, string xbox_id )

  • Set the Xbox Pairwise ID for this identity.
  • Returns a bool.

toIdentityString( string reference_name)

  • Print to a human-readable string. This is suitable for debug messages or any other time you need to encode the identity as a string. It has a URL-like format type:. Your buffer should be at least k_cchMaxString (128) bytes big to avoid truncation.
  • Returns nothing; void.

toIPAddressString( string reference_name, bool with_port)

  • Print to a string, with or without the port. Mapped IPv4 addresses are printed as dotted decimal (12.34.56.78), otherwise this will print the canonical form according to RFC5952. If you include the port, IPv6 will be surrounded by brackets, e.g. [::1:2]:80. Your buffer should be at least k_cchMaxString (128) bytes to avoid truncation.
  • Returns a string.

setIPv4( string reference_name, int ip, int port ) setIPv4( string reference_name, uint32 ip, uint16 port )

  • Sets to IPv4 mapped address. IP and port are in host byte order.
  • Returns nothing; void.

setIPv6( string reference_name, int ipv6, int port ) setIPv6( string reference_name, uint8 ipv6, uint16 port )

  • Set IPv6 address. IP is interpreted as bytes, so there are no endian issues. (Same as inaddr_in6.) The IP can be a mapped IPv4 address.
  • Returns nothing; void.

setIPv6LocalHost( string reference_name, int port ) setIPv6LocalHost( string reference_name, uint16 port )

  • Set to the IPv6 localhost address ::1, and the specified port.
  • Returns nothing; void.