SteamNetworkingIPAddr

Swift
public final class SteamNetworkingIPAddr: @unchecked Sendable

extension SteamNetworkingIPAddr: Equatable, CustomStringConvertible

Steamworks SteamNetworkingIPAddr


Topics

Fields

var isIPv6AllZeros: Bool

Declaration
Swift
public var isIPv6AllZeros: Bool { get }

var isIPv4: Bool

Declaration
Swift
public var isIPv4: Bool { get }

var isLocalHost: Bool

Declaration
Swift
public var isLocalHost: Bool { get }

var ipv4: Int

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

Declaration
Swift
public var ipv4: Int { get }

var ipv6: [UInt8]

Declaration
Swift
public var ipv6: [UInt8] { get }

var port: UInt16

Declaration
Swift
public var port: UInt16 { get }

var fakeIPType: SteamNetworkingFakeIPType

Classify address as FakeIP. Never returns k_ESteamNetworkingFakeIPType_Invalid.

Declaration
Swift
public var fakeIPType: SteamNetworkingFakeIPType { get }

var isFakeIP: Bool

Return true if we are a FakeIP

Declaration
Swift
public var isFakeIP: Bool { get }

func toString(withPort: Bool) -> String

Declaration
Swift
public func toString(withPort: Bool = true) -> String

Initializers

init()

An invalid address

Declaration
Swift
public init()

init(inaddrAnyPort: UInt16)

INADDR_ANY with some port

Declaration
Swift
public convenience init(inaddrAnyPort port: UInt16)

init(ipv4: Int, port: UInt16)

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

Declaration
Swift
public convenience init(ipv4: Int, port: UInt16)

init(ipv6: [UInt8], port: UInt16)

IP is interpreted as bytes, so there are no endian issues. (Same as inaddr_in6.) The IP can be a mapped IPv4 address.

Declaration
Swift
public convenience init(ipv6: [UInt8], port: UInt16)

init?(addressAndPort: String)

Parse an IP address and optional port. If a port is not present, it is set to 0.

Declaration
Swift
public convenience init?(addressAndPort: String)

SteamNetworkingIPAddr

static func ==(lhs: SteamNetworkingIPAddr, rhs: SteamNetworkingIPAddr) -> Bool

Returns a Boolean value indicating whether two values are equal.

Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

Declaration
Swift
public static func == (lhs: SteamNetworkingIPAddr, rhs: SteamNetworkingIPAddr)
    -> Bool
Parameters
lhs

A value to compare.

rhs

Another value to compare.

var description: String

A textual representation of this instance.

Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(describing:) initializer. This initializer works with any type, and uses the custom description property for types that conform to CustomStringConvertibleCustomStringConvertible:

struct Point: CustomStringConvertible {
    let x: Int, y: Int

    var description: String {
        return "(\(x), \(y))"
    }
}

let p = Point(x: 21, y: 30)
let s = String(describing: p)
print(s)
// Prints "(21, 30)"

The conversion of p to a string in the assignment to s uses the Point type’s description property.

Declaration
Swift
public var description: String { get }