swiftlys2/docs/api/releases/features/ai/
API Reference › SteamAPI

SteamNetworkingIPAddr

Struct
Namespace: SwiftlyS2.Shared.SteamAPI · Assembly: SwiftlyS2.CS2.dll
[Serializable]
public struct SteamNetworkingIPAddr : IEquatable<SteamNetworkingIPAddr>

Store an IP and port. IPv6 is always used; IPv4 is represented using "IPv4-mapped" addresses: IPv4 aa.bb.cc.dd => IPv6 ::ffff:aabb:ccdd (RFC 4291 section 2.5.5.2.)

View source

Methods

Clear()

Set everything to zero. E.g. [::]:0

public void Clear()

Equals(SteamNetworkingIPAddr)

See if two addresses are identical

public bool Equals(SteamNetworkingIPAddr x)
Returns

GetFakeIPType()

Classify address as FakeIP. This function never returns k_ESteamNetworkingFakeIPType_Invalid.

public ESteamNetworkingFakeIPType GetFakeIPType()

GetIPv4()

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

public uint GetIPv4()
Returns

IsFakeIP()

Return true if we are a FakeIP

public bool IsFakeIP()
Returns

IsIPv4()

Return true if IP is mapped IPv4

public bool IsIPv4()
Returns

IsIPv6AllZeros()

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

public bool IsIPv6AllZeros()
Returns

IsLocalHost()

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

public bool IsLocalHost()
Returns

ParseString(string)

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.)

public bool ParseString(string pszStr)
Parameters
Returns

SetIPv4(uint, ushort)

Sets to IPv4 mapped address. IP and port are in host byte order.

public void SetIPv4(uint nIP, ushort nPort)
Parameters

SetIPv6(byte[], ushort)

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

public void SetIPv6(byte[] ipv6, ushort nPort)
Parameters

SetIPv6LocalHost(ushort)

Set to the IPv6 localhost address ::1, and the specified port.

public void SetIPv6LocalHost(ushort nPort = 0)
Parameters

ToString(out string, bool)

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 bytes to avoid truncation See also SteamNetworkingIdentityRender

public void ToString(out string buf, bool bWithPort)
Parameters

Fields

k_cchMaxString

Max length of the buffer needed to hold IP formatted using ToString, including '\0' ([0123:4567:89ab:cdef:0123:4567:89ab:cdef]:12345)

public const int k_cchMaxString = 48
Field Value

m_ipv6

public byte* m_ipv6
Field Value

m_port

Host byte order

public ushort m_port
Field Value