SteamNetworkingIdentity
Struct[Serializable]
public struct SteamNetworkingIdentity : IEquatable<SteamNetworkingIdentity>An abstract way to represent the identity of a network host. All identities can be represented as simple string. Furthermore, this string representation is actually used on the wire in several places, even though it is less efficient, in order to facilitate forward compatibility. (Old client code can handle an identity type that it doesn't understand.)
View sourceMethods
See if two identities are identical
public bool Equals(SteamNetworkingIdentity x)Returns null if not generic bytes type
public byte[] GetGenericBytes(out int cbLen)- cbLenint
Returns nullptr if not generic string type
public string GetGenericString()returns null if we are not an IP address.
public SteamNetworkingIPAddr GetIPAddr()Return black CSteamID (!IsValid()) if identity is not a SteamID
public CSteamID GetSteamID()Return true if we are the invalid type. Does not make any other validity checks (e.g. is SteamID actually valid)
public bool IsInvalid()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:<type-data> and doesn't have any funky characters, etc), then we will return true, and the type is set to k_ESteamNetworkingIdentityType_UnknownType. false will only be returned if the string looks invalid.
public bool ParseString(string pszStr)- pszStrstring
Returns false if invalid size.
public bool SetGenericBytes(byte[] data, uint cbLen)Returns false if invalid length
public bool SetGenericString(string pszString)- pszStringstring
Set to specified IP:port
public void SetIPAddr(SteamNetworkingIPAddr addr)public void SetIPv4Addr(uint nIPv4, ushort nPort)"localhost" is equivalent for many purposes to "anonymous." Our remote will identify us by the network address we use. Set to localhost. (We always use IPv6 ::1 for this, not 127.0.0.1)
public void SetLocalHost()Returns false if invalid length
public bool SetXboxPairwiseID(string pszString)- pszStringstring
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:<type-data>). Your buffer should be at least k_cchMaxString bytes big to avoid truncation. See also SteamNetworkingIPAddrRender
public void ToString(out string buf)- bufstring
Fields
Max length of the string for generic string identities. Including terminating '\0'
public const int k_cchMaxGenericString = 32Max sizes Max length of the buffer needed to hold any identity, formatted in string format by ToString
public const int k_cchMaxString = 128Including terminating '\0'
public const int k_cchMaxXboxPairwiseID = 33Type of identity.
public ESteamNetworkingIdentityType m_eType