Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
PeerState
ENetPacketPeer.swift:18enum PeerState
Cases
case disconnected
The peer is disconnected.
case connecting
The peer is currently attempting to connect.
case acknowledgingConnect
The peer has acknowledged the connection request.
case connectionPending
The peer is currently connecting.
case connectionSucceeded
The peer has successfully connected, but is not ready to communicate with yet (.stateConnected).
case connected
The peer is currently connected and ready to communicate with.
case disconnectLater
The peer is slated to disconnect after it has no more outgoing packets to send.
case disconnecting
The peer is currently disconnecting.
case acknowledgingDisconnect
The peer has acknowledged the disconnection request.
case zombie
The peer has lost connection, but is not considered truly disconnected (as the peer didn’t acknowledge the disconnection request).
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (22) members.
Types
Type members
static let flagReliable: Int
Mark the packet to be sent as reliable.
static let flagUnreliableFragment: Int
Mark the packet to be sent unreliable even if the packet is too big and needs fragmentation (increasing the chance of it being dropped).
static let flagUnsequenced: Int
Mark the packet to be sent unsequenced (unreliable).
static let packetLossScale: Int
The reference scale for packet loss. See
getStatistic(_:)
and .peerPacketLoss.static let packetThrottleScale: Int
The reference value for throttle configuration. The default value is
32
. SeethrottleConfigure(interval:acceleration:deceleration:)
.class var godotClassName: StringName
Instance members
func getChannels(
) -> Int32 Returns the number of channels allocated for communication with peer.
func getRemoteAddress(
) -> String Returns the IP address of this peer.
func getRemotePort(
) -> Int32 Returns the remote port of this peer.
func getState(
) -> ENetPacketPeer.PeerState Returns the current peer state. See
PeerState
.func getStatistic(ENetPacketPeer.PeerStatistic
) -> Double Returns the requested
statistic
for this peer. SeePeerStatistic
.func isActive(
) -> Bool Returns
true
if the peer is currently active (i.e. the associatedENetConnection
is still valid).func peerDisconnect(data: Int32
) Request a disconnection from a peer. An
ENetConnection/EventType/eventDisconnect
will be generated duringservice(timeout:)
once the disconnection is complete.func peerDisconnectLater(data: Int32
) Request a disconnection from a peer, but only after all queued outgoing packets are sent. An
ENetConnection/EventType/eventDisconnect
will be generated duringservice(timeout:)
once the disconnection is complete.func peerDisconnectNow(data: Int32
) Force an immediate disconnection from a peer. No
ENetConnection/EventType/eventDisconnect
will be generated. The foreign peer is not guaranteed to receive the disconnect notification, and is reset immediately upon return from this function.func ping(
) Sends a ping request to a peer. ENet automatically pings all connected peers at regular intervals, however, this function may be called to ensure more frequent ping requests.
func pingInterval(pingInterval: Int32
) Sets the
pingInterval
in milliseconds at which pings will be sent to a peer. Pings are used both to monitor the liveness of the connection and also to dynamically adjust the throttle during periods of low traffic so that the throttle has reasonable responsiveness during traffic spikes. The default ping interval is500
milliseconds.func reset(
) Forcefully disconnects a peer. The foreign host represented by the peer is not notified of the disconnection and will timeout on its connection to the local host.
func send(channel: Int32, packet: PackedByteArray, flags: Int32
) -> GodotError Queues a
packet
to be sent over the specifiedchannel
. SeeFLAG_*
constants for available packet flags.func setTimeout(Int32, timeoutMin: Int32, timeoutMax: Int32
) Sets the timeout parameters for a peer. The timeout parameters control how and when a peer will timeout from a failure to acknowledge reliable traffic. Timeout values are expressed in milliseconds.
func throttleConfigure(interval: Int32, acceleration: Int32, deceleration: Int32
) Configures throttle parameter for a peer.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.