SteamNetworkingSockets

Swift
public struct SteamNetworkingSockets: Sendable

Steamworks ISteamNetworkingSockets

Access via networkingSockets through a SteamAPI or SteamGameServerAPI instance.


Topics

func acceptConnection(conn: HSteamNetConnection) -> Result

Steamworks ISteamNetworkingSockets::AcceptConnection()

Declaration
Swift
public func acceptConnection(conn: HSteamNetConnection) -> Result

func beginAsyncRequestFakeIP(numPorts: Int) -> Bool

Steamworks ISteamNetworkingSockets::BeginAsyncRequestFakeIP()

Declaration
Swift
public func beginAsyncRequestFakeIP(numPorts: Int) -> Bool

func closeConnection(peer: HSteamNetConnection, reason: Int, debug: String?, enableLinger: Bool) -> Bool

Steamworks ISteamNetworkingSockets::CloseConnection()

Declaration
Swift
@discardableResult
public func closeConnection(
    peer: HSteamNetConnection, reason: Int, debug: String?, enableLinger: Bool
) -> Bool

func closeListenSocket(socket: HSteamListenSocket) -> Bool

Steamworks ISteamNetworkingSockets::CloseListenSocket()

Declaration
Swift
@discardableResult
public func closeListenSocket(socket: HSteamListenSocket) -> Bool

func configureConnectionLanes(conn: HSteamNetConnection, lanePriorities: [Int], laneWeights: [UInt16]) -> Result

Steamworks ISteamNetworkingSockets::ConfigureConnectionLanes()

Declaration
Swift
public func configureConnectionLanes(
    conn: HSteamNetConnection, lanePriorities: [Int], laneWeights: [UInt16]
) -> Result

func connectByIPAddress(address: SteamNetworkingIPAddr, options: [SteamNetworkingConfigValue]) -> HSteamNetConnection

Steamworks ISteamNetworkingSockets::ConnectByIPAddress()

Declaration
Swift
public func connectByIPAddress(
    address: SteamNetworkingIPAddr, options: [SteamNetworkingConfigValue]
) -> HSteamNetConnection

func connectP2P(identityRemote: SteamNetworkingIdentity, remoteVirtualPort: Int, options: [SteamNetworkingConfigValue]) -> HSteamNetConnection

Steamworks ISteamNetworkingSockets::ConnectP2P()

Declaration
Swift
public func connectP2P(
    identityRemote: SteamNetworkingIdentity, remoteVirtualPort: Int,
    options: [SteamNetworkingConfigValue]
) -> HSteamNetConnection

func connectToHostedDedicatedServer(identityTarget: SteamNetworkingIdentity, remoteVirtualPort: Int, options: [SteamNetworkingConfigValue]) -> HSteamNetConnection

Steamworks ISteamNetworkingSockets::ConnectToHostedDedicatedServer()

Declaration
Swift
public func connectToHostedDedicatedServer(
    identityTarget: SteamNetworkingIdentity, remoteVirtualPort: Int,
    options: [SteamNetworkingConfigValue]
) -> HSteamNetConnection

func createFakeUDPPort(fakeServerPort: Int) -> SteamNetworkingFakeUDPPort

Steamworks ISteamNetworkingSockets::CreateFakeUDPPort()

Declaration
Swift
public func createFakeUDPPort(fakeServerPort: Int) -> SteamNetworkingFakeUDPPort

func createHostedDedicatedServerListenSocket(localVirtualPort: Int, options: [SteamNetworkingConfigValue]) -> HSteamListenSocket

Steamworks ISteamNetworkingSockets::CreateHostedDedicatedServerListenSocket()

Declaration
Swift
public func createHostedDedicatedServerListenSocket(
    localVirtualPort: Int, options: [SteamNetworkingConfigValue]
) -> HSteamListenSocket

func createListenSocketIP(address: SteamNetworkingIPAddr, options: [SteamNetworkingConfigValue]) -> HSteamListenSocket

Steamworks ISteamNetworkingSockets::CreateListenSocketIP()

Declaration
Swift
public func createListenSocketIP(
    address: SteamNetworkingIPAddr, options: [SteamNetworkingConfigValue]
) -> HSteamListenSocket

func createListenSocketP2P(localVirtualPort: Int, options: [SteamNetworkingConfigValue]) -> HSteamListenSocket

Steamworks ISteamNetworkingSockets::CreateListenSocketP2P()

Declaration
Swift
public func createListenSocketP2P(
    localVirtualPort: Int, options: [SteamNetworkingConfigValue]
) -> HSteamListenSocket

func createListenSocketP2PFakeIP(fakePort: Int, options: [SteamNetworkingConfigValue]) -> HSteamListenSocket

Steamworks ISteamNetworkingSockets::CreateListenSocketP2PFakeIP()

Declaration
Swift
public func createListenSocketP2PFakeIP(
    fakePort: Int, options: [SteamNetworkingConfigValue]
) -> HSteamListenSocket

func createPollGroup() -> HSteamNetPollGroup

Steamworks ISteamNetworkingSockets::CreatePollGroup()

Declaration
Swift
public func createPollGroup() -> HSteamNetPollGroup

func createSocketPair(useNetworkLoopback: Bool, identity1: SteamNetworkingIdentity?, identity2: SteamNetworkingIdentity?) -> (rc: Bool, connection1: HSteamNetConnection, connection2: HSteamNetConnection)

Steamworks ISteamNetworkingSockets::CreateSocketPair()

Declaration
Swift
public func createSocketPair(
    useNetworkLoopback: Bool, identity1: SteamNetworkingIdentity?,
    identity2: SteamNetworkingIdentity?
) -> (
    rc: Bool, connection1: HSteamNetConnection, connection2: HSteamNetConnection
)

func destroyPollGroup(pollGroup: HSteamNetPollGroup) -> Bool

Steamworks ISteamNetworkingSockets::DestroyPollGroup()

Declaration
Swift
@discardableResult
public func destroyPollGroup(pollGroup: HSteamNetPollGroup) -> Bool

func flushMessagesOnConnection(conn: HSteamNetConnection) -> Result

Steamworks ISteamNetworkingSockets::FlushMessagesOnConnection()

Declaration
Swift
@discardableResult
public func flushMessagesOnConnection(conn: HSteamNetConnection) -> Result

func getAuthenticationStatus(returnDetails: Bool) -> (rc: SteamNetworkingAvailability, details: SteamNetAuthenticationStatus)

Steamworks ISteamNetworkingSockets::GetAuthenticationStatus()

Declaration
Swift
public func getAuthenticationStatus(returnDetails: Bool = true) -> (
    rc: SteamNetworkingAvailability, details: SteamNetAuthenticationStatus
)

func getCertificateRequest(blobSize: Int, returnBlob: Bool) -> (rc: Bool, blobSize: Int, blob: [UInt8], msg: String)

Steamworks ISteamNetworkingSockets::GetCertificateRequest()

Declaration
Swift
public func getCertificateRequest(blobSize: Int, returnBlob: Bool = true) -> (
    rc: Bool, blobSize: Int, blob: [UInt8], msg: String
)

func getConnectionInfo(conn: HSteamNetConnection) -> (rc: Bool, info: SteamNetConnectionInfo)

Steamworks ISteamNetworkingSockets::GetConnectionInfo()

Declaration
Swift
public func getConnectionInfo(conn: HSteamNetConnection) -> (
    rc: Bool, info: SteamNetConnectionInfo
)

func getConnectionName(peer: HSteamNetConnection, maxLen: Int) -> (rc: Bool, name: String)

Steamworks ISteamNetworkingSockets::GetConnectionName()

Declaration
Swift
public func getConnectionName(peer: HSteamNetConnection, maxLen: Int) -> (
    rc: Bool, name: String
)

func getConnectionRealTimeStatus(conn: HSteamNetConnection, returnStatus: Bool, laneCount: Int, returnLaneStatus: Bool) -> (rc: Result, status: SteamNetConnectionRealTimeStatus, laneStatus: [SteamNetConnectionRealTimeLaneStatus])

Steamworks ISteamNetworkingSockets::GetConnectionRealTimeStatus()

Declaration
Swift
public func getConnectionRealTimeStatus(
    conn: HSteamNetConnection, returnStatus: Bool = true, laneCount: Int,
    returnLaneStatus: Bool = true
) -> (
    rc: Result, status: SteamNetConnectionRealTimeStatus,
    laneStatus: [SteamNetConnectionRealTimeLaneStatus]
)

func getConnectionUserData(peer: HSteamNetConnection) -> Int

Steamworks ISteamNetworkingSockets::GetConnectionUserData()

Declaration
Swift
public func getConnectionUserData(peer: HSteamNetConnection) -> Int

func getDetailedConnectionStatus(conn: HSteamNetConnection, returnBuf: Bool, bufSize: Int) -> (rc: Int, buf: String)

Steamworks ISteamNetworkingSockets::GetDetailedConnectionStatus()

Declaration
Swift
public func getDetailedConnectionStatus(
    conn: HSteamNetConnection, returnBuf: Bool = true, bufSize: Int
) -> (rc: Int, buf: String)

func getFakeIP(firstPort: Int) -> SteamNetworkingFakeIPResult

Steamworks ISteamNetworkingSockets::GetFakeIP()

Declaration
Swift
public func getFakeIP(firstPort: Int) -> SteamNetworkingFakeIPResult

func getHostedDedicatedServerPOPID() -> SteamNetworkingPOPID

Steamworks ISteamNetworkingSockets::GetHostedDedicatedServerPOPID()

Declaration
Swift
public func getHostedDedicatedServerPOPID() -> SteamNetworkingPOPID

func getHostedDedicatedServerPort() -> UInt16

Steamworks ISteamNetworkingSockets::GetHostedDedicatedServerPort()

Declaration
Swift
public func getHostedDedicatedServerPort() -> UInt16

func getIdentity() -> (rc: Bool, identity: SteamNetworkingIdentity)

Steamworks ISteamNetworkingSockets::GetIdentity()

Declaration
Swift
public func getIdentity() -> (rc: Bool, identity: SteamNetworkingIdentity)

func getListenSocketAddress(socket: HSteamListenSocket) -> (rc: Bool, address: SteamNetworkingIPAddr)

Steamworks ISteamNetworkingSockets::GetListenSocketAddress()

Declaration
Swift
public func getListenSocketAddress(socket: HSteamListenSocket) -> (
    rc: Bool, address: SteamNetworkingIPAddr
)

func getRemoteFakeIPForConnection(conn: HSteamNetConnection) -> (rc: Result, addr: SteamNetworkingIPAddr)

Steamworks ISteamNetworkingSockets::GetRemoteFakeIPForConnection()

Declaration
Swift
public func getRemoteFakeIPForConnection(conn: HSteamNetConnection) -> (
    rc: Result, addr: SteamNetworkingIPAddr
)

func initAuthentication() -> SteamNetworkingAvailability

Steamworks ISteamNetworkingSockets::InitAuthentication()

Declaration
Swift
@discardableResult
public func initAuthentication() -> SteamNetworkingAvailability

func receiveMessagesOnConnection(conn: HSteamNetConnection, maxMessages: Int) -> (rc: Int, messages: [SteamNetworkingMessage])

Steamworks ISteamNetworkingSockets::ReceiveMessagesOnConnection()

Declaration
Swift
public func receiveMessagesOnConnection(
    conn: HSteamNetConnection, maxMessages: Int
) -> (rc: Int, messages: [SteamNetworkingMessage])

func receiveMessagesOnPollGroup(pollGroup: HSteamNetPollGroup, maxMessages: Int) -> (rc: Int, messages: [SteamNetworkingMessage])

Steamworks ISteamNetworkingSockets::ReceiveMessagesOnPollGroup()

Declaration
Swift
public func receiveMessagesOnPollGroup(
    pollGroup: HSteamNetPollGroup, maxMessages: Int
) -> (rc: Int, messages: [SteamNetworkingMessage])

func resetIdentity(identity: SteamNetworkingIdentity?)

Steamworks ISteamNetworkingSockets::ResetIdentity()

Declaration
Swift
public func resetIdentity(identity: SteamNetworkingIdentity?)

func runCallbacks()

Steamworks ISteamNetworkingSockets::RunCallbacks()

Declaration
Swift
public func runCallbacks()

func sendMessageToConnection(conn: HSteamNetConnection, data: UnsafeRawPointer, dataSize: Int, sendFlags: SteamNetworkingSendFlags, returnMessageNumber: Bool) -> (rc: Result, messageNumber: Int)

Steamworks ISteamNetworkingSockets::SendMessageToConnection()

Declaration
Swift
public func sendMessageToConnection(
    conn: HSteamNetConnection, data: UnsafeRawPointer, dataSize: Int,
    sendFlags: SteamNetworkingSendFlags, returnMessageNumber: Bool = true
) -> (rc: Result, messageNumber: Int)

func sendMessages(messages: [SteamNetworkingMessage], returnMessageNumberOrResult: Bool) -> [Int]

Steamworks ISteamNetworkingSockets::SendMessages()

Declaration
Swift
public func sendMessages(
    messages: [SteamNetworkingMessage], returnMessageNumberOrResult: Bool = true
) -> [Int]

func setCertificate(certificate: [UInt8]) -> (rc: Bool, msg: String)

Steamworks ISteamNetworkingSockets::SetCertificate()

Declaration
Swift
public func setCertificate(certificate: [UInt8]) -> (rc: Bool, msg: String)

func setConnectionName(peer: HSteamNetConnection, name: String)

Steamworks ISteamNetworkingSockets::SetConnectionName()

Declaration
Swift
public func setConnectionName(peer: HSteamNetConnection, name: String)

func setConnectionPollGroup(conn: HSteamNetConnection, pollGroup: HSteamNetPollGroup) -> Bool

Steamworks ISteamNetworkingSockets::SetConnectionPollGroup()

Declaration
Swift
@discardableResult
public func setConnectionPollGroup(
    conn: HSteamNetConnection, pollGroup: HSteamNetPollGroup
) -> Bool

func setConnectionUserData(peer: HSteamNetConnection, userData: Int) -> Bool

Steamworks ISteamNetworkingSockets::SetConnectionUserData()

Declaration
Swift
@discardableResult
public func setConnectionUserData(peer: HSteamNetConnection, userData: Int)
    -> Bool

func getCertificateRequest() -> (rc: Bool, blob: [UInt8], msg: String)

Note

Provided by module SteamworksHelpers.

Steamworks ISteamNetworkingSockets::GetCertificateRequest()

Declaration
Swift
public func getCertificateRequest() -> (rc: Bool, blob: [UInt8], msg: String)

func getDetailedConnectionStatus(conn: HSteamNetConnection) -> (rc: Int, buf: String)

Note

Provided by module SteamworksHelpers.

Steamworks ISteamNetworkingSockets::GetDetailedConnectionStatus()

Declaration
Swift
public func getDetailedConnectionStatus(conn: HSteamNetConnection) -> (
    rc: Int, buf: String
)

func closeConnection(peer: HSteamNetConnection, reason: SteamNetConnectionEnd, debug: String?, enableLinger: Bool) -> Bool

Note

Provided by module SteamworksHelpers.

Steamworks ISteamNetworkingSockets::CloseConnection() – for built-in end-reasons

Declaration
Swift
@discardableResult
public func closeConnection(
    peer: HSteamNetConnection, reason: SteamNetConnectionEnd, debug: String?,
    enableLinger: Bool
) -> Bool