Component
Networking
(NOTE) Network Peer. Acts as a host on the network. Manages network object state and event replication.
Properties
BasicHostInfoTimeout : real
[Client/Server] Determines the amount of time the client is willing to wait for.
var BasicHostInfoTimeout : Real
ExtraHostInfoTimeout : real
[Client/Server] Determines the amount of time the client will wait for extra host info from a server.
var ExtraHostInfoTimeout : Real
FrameFillSkip : real
Controls when to skip change replication for the current frame because of remaining outgoing bandwidth utilization ratio on any given link.
var FrameFillSkip : Real
FrameFillWarning : real
Controls when the user will be warned of their current frame's outgoing bandwidth utilization ratio on any given link.
var FrameFillWarning : Real
HostPingInterval : real
[Client/Server] The time between (potentially) redundant pings from a net peer.
var HostPingInterval : Real
HostPortRangeEnd : integer
Configures the inclusive range of ports used to host this game.
var HostPortRangeEnd : Integer
HostPortRangeStart : integer
Configures the inclusive range of ports used to host this game.
var HostPortRangeStart : Integer
Info : string
read-only
Current peer identifier information display string. Provided for logging and debugging convenience. Contains the peer's local IP address, network role, and net peer ID.
var Info : String
InternetDiscoverable : boolean
Configures the server peer to be discoverable on the internet.
var InternetDiscoverable : Boolean
InternetHostListTimeout : real
[Client/Server] Determines the amount of time the client is willing to wait to get a host list from master server.
var InternetHostListTimeout : Real
InternetHostPublishInterval : real
Controls how often the internet discoverable peer sends a host record message to its master server subscriptions.
var InternetHostPublishInterval : Real
InternetHostRecordLifetime : real
Controls the lifetime of every host record stored on the master server.
var InternetHostRecordLifetime : Real
InternetSameIpHostRecordLimit : integer
Controls how many host records from the same IP address may be stored on the master server (used to prevent flood attacks).
var InternetSameIpHostRecordLimit : Integer
Ipv4Address : ipaddress
read-only
Returns the peer's local IPv4 address, else IpAddress(). Set if the peer is open with an IPv4 socket.
var Ipv4Address : IpAddress
Ipv4Host : string
read-only
Returns the peer's local IPv4 address host as a numeric address string, else String().
var Ipv4Host : String
Ipv4Port : integer
read-only
Returns the peer's local IPv4 address port, else String().
var Ipv4Port : Integer
IsOpen : boolean
read-only
Returns true if the peer is open, else false.
var IsOpen : Boolean
LanDiscoverable : boolean
Configures the server peer to be discoverable on the local area network.
var LanDiscoverable : Boolean
LinkCount : integer
read-only
[Client/Server] Returns the number of connected network links managed by this peer.
var LinkCount : Integer
NetObjectCount : integer
read-only
Returns the number of net objects in this game session (but not including the net peer itself).
var NetObjectCount : Integer
NetPeerId : integer
read-only
Returns the open peer's unique network identifier, else 0. [Server/Offline] This will always be zero. [Client] This will be non-zero once connected to a server, else zero.
var NetPeerId : Integer
NetSpaceCount : integer
read-only
Returns the number of net spaces in this game session.
var NetSpaceCount : Integer
NetUserCount : integer
read-only
Returns the number of net users in this game session.
var NetUserCount : Integer
UserCount : integer
read-only
Returns the number of added network users.
var UserCount : Integer
Users : netuserrange
read-only
Returns all added network users.
var Users : NetUserRange
UsersAddedByMyPeer : netuserrange
read-only
Returns the network users added by our local peer.
var UsersAddedByMyPeer : NetUserRange
Methods
AddUser : boolean
Initiates a network user add request to add a new user belonging to our local peer (delayed until end of frame). Listen to the NetUser event interface to handle the results. Returns true if the request was successfully initiated, else false. |Name|Type|Description| |---|---|---|
function AddUser() : Boolean
AddUser : boolean
Initiates a network user add request to add a new user belonging to our local peer (delayed until end of frame). Listen to the NetUser event interface to handle the results. Returns true if the request was successfully initiated, else false. |Name|Type|Description| |---|---|---| |requestEvent|event| |
function AddUser(requestEvent : Event) : Boolean
AddUser : boolean
Initiates a network user add request to add a new user belonging to our local peer (delayed until end of frame). Listen to the NetUser event interface to handle the results. Returns true if the request was successfully initiated, else false. |Name|Type|Description| |---|---|---| |requestBundle|eventbundle| |
function AddUser(requestBundle : EventBundle) : Boolean
CancelHostRequests : Void
Cancels all host discovery and refresh requests currently in progress (the operations will be considered unsuccessful). Listen to the NetHost event interface to handle the results. |Name|Type|Description| |---|---|---|
function CancelHostRequests()
ClearHostList : Void
Clears the given network's host list. |Name|Type|Description| |---|---|---| |network|Network| |
function ClearHostList(network : Network)
ClearHostLists : Void
Name Type Description function ClearHostLists()
Close : Void
Closes the peer (safe to call multiple times). |Name|Type|Description| |---|---|---|
function Close()
ConnectLink : boolean
[Client] Initiates a connect attempt with the remote peer (delayed until end of frame). Listen to the NetLink event interface to handle the results. Returns true if a connect request was successfully initiated, else false. |Name|Type|Description| |---|---|---| |ipAddress|ipaddress| |
function ConnectLink(ipAddress : IpAddress) : Boolean
ConnectLink : boolean
[Client] Initiates a connect attempt with the remote peer (delayed until end of frame). Listen to the NetLink event interface to handle the results. Returns true if a connect request was successfully initiated, else false. |Name|Type|Description| |---|---|---| |ipAddress|ipaddress| | |requestEvent|event| |
function ConnectLink(ipAddress : IpAddress, requestEvent : Event) : Boolean
ConnectLink : boolean
[Client] Initiates a connect attempt with the remote peer (delayed until end of frame). Listen to the NetLink event interface to handle the results. Returns true if a connect request was successfully initiated, else false. |Name|Type|Description| |---|---|---| |ipAddress|ipaddress| | |requestBundle|eventbundle| |
function ConnectLink(ipAddress : IpAddress, requestBundle : EventBundle) : Boolean
DisconnectAllLinks : integer
[Client/Server] Disconnects by request from all remote peers. Listen to the NetLink event interface to handle the results. Returns the number of links disconnected. |Name|Type|Description| |---|---|---|
function DisconnectAllLinks() : Integer
DisconnectAllLinks : integer
[Client/Server] Disconnects by request from all remote peers. Listen to the NetLink event interface to handle the results. Returns the number of links disconnected. |Name|Type|Description| |---|---|---| |requestEvent|event| |
function DisconnectAllLinks(requestEvent : Event) : Integer
DisconnectAllLinks : integer
[Client/Server] Disconnects by request from all remote peers. Listen to the NetLink event interface to handle the results. Returns the number of links disconnected. |Name|Type|Description| |---|---|---| |requestBundle|eventbundle| |
function DisconnectAllLinks(requestBundle : EventBundle) : Integer
DisconnectLink : boolean
[Client/Server] Disconnects by request from the remote peer. Listen to the NetLink event interface to handle the results. Returns true if a disconnect notice was successfully initiated, else false. |Name|Type|Description| |---|---|---| |netPeerId|integer| |
function DisconnectLink(netPeerId : Integer) : Boolean
DisconnectLink : boolean
[Client/Server] Disconnects by request from the remote peer. Listen to the NetLink event interface to handle the results. Returns true if a disconnect notice was successfully initiated, else false. |Name|Type|Description| |---|---|---| |netPeerId|integer| | |requestEvent|event| |
function DisconnectLink(netPeerId : Integer, requestEvent : Event) : Boolean
DisconnectLink : boolean
[Client/Server] Disconnects by request from the remote peer. Listen to the NetLink event interface to handle the results. Returns true if a disconnect notice was successfully initiated, else false. |Name|Type|Description| |---|---|---| |netPeerId|integer| | |requestBundle|eventbundle| |
function DisconnectLink(netPeerId : Integer, requestBundle : EventBundle) : Boolean
DisconnectLink : boolean
[Client/Server] Disconnects by request from the remote peer. Listen to the NetLink event interface to handle the results. Returns true if a disconnect notice was successfully initiated, else false. |Name|Type|Description| |---|---|---| |ipAddress|ipaddress| |
function DisconnectLink(ipAddress : IpAddress) : Boolean
DisconnectLink : boolean
[Client/Server] Disconnects by request from the remote peer. Listen to the NetLink event interface to handle the results. Returns true if a disconnect notice was successfully initiated, else false. |Name|Type|Description| |---|---|---| |ipAddress|ipaddress| | |requestEvent|event| |
function DisconnectLink(ipAddress : IpAddress, requestEvent : Event) : Boolean
DisconnectLink : boolean
[Client/Server] Disconnects by request from the remote peer. Listen to the NetLink event interface to handle the results. Returns true if a disconnect notice was successfully initiated, else false. |Name|Type|Description| |---|---|---| |ipAddress|ipaddress| | |requestBundle|eventbundle| |
function DisconnectLink(ipAddress : IpAddress, requestBundle : EventBundle) : Boolean
DiscoverHostList : boolean
Discovers the given network's host list. Listen to the NetHost event interface to handle the results. Returns true if the discovery was successfully started, else false. |Name|Type|Description| |---|---|---| |network|Network| | |removeStaleHosts|boolean| |
function DiscoverHostList(network : Network, removeStaleHosts : Boolean) : Boolean
GetHostByAddress : nethost
Name Type Description ipAddress ipaddress function GetHostByAddress(ipAddress : IpAddress) : NetHost
GetHostByAddress : nethost
Name Type Description network Network ipAddress ipaddress function GetHostByAddress(network : Network, ipAddress : IpAddress) : NetHost
GetHostByIndex : nethost
Returns the first equivalent host found in the given network's host list, else nullptr. |Name|Type|Description| |---|---|---| |network|Network| | |index|integer| |
function GetHostByIndex(network : Network, index : Integer) : NetHost
GetHostList : nethostrange
Returns the given network's host list. |Name|Type|Description| |---|---|---| |network|Network| |
function GetHostList(network : Network) : NetHostRange
GetLinkCreationDirection : TransmissionDirection
[Client/Server] Returns the direction in which the link was created (which peer initiated the connection), else TransmissionDirection::Unspecified. |Name|Type|Description| |---|---|---| |netPeerId|integer| |
function GetLinkCreationDirection(netPeerId : Integer) : TransmissionDirection
GetLinkInternetProtocol : InternetProtocol
[Client/Server] Returns the link's IP address protocol version, else InternetProtocol::Unspecified. This IP address protocol will never change for the lifetime of this link. |Name|Type|Description| |---|---|---| |netPeerId|integer| |
function GetLinkInternetProtocol(netPeerId : Integer) : InternetProtocol
GetLinkIpAddress : ipaddress
[Client/Server] Returns the remote peer's IP address (as seen from our perspective), else IpAddress(). For outgoing links this is the same IP address specified in our connect call. This IP address will never change for the lifetime of this link. |Name|Type|Description| |---|---|---| |netPeerId|integer| |
function GetLinkIpAddress(netPeerId : Integer) : IpAddress
GetLinkNetPeerId : integer
Returns the remote peer's unique network identifier, else 0. [Server] This will be non-zero if the client is connected, else zero. [Client] This will always be zero. |Name|Type|Description| |---|---|---| |ipAddress|ipaddress| |
function GetLinkNetPeerId(ipAddress : IpAddress) : Integer
GetLinkState : LinkState
[Client/Server] Returns the link's specific state, else LinkState::Unspecified. |Name|Type|Description| |---|---|---| |netPeerId|integer| |
function GetLinkState(netPeerId : Integer) : LinkState
GetLinkStatus : LinkStatus
[Client/Server] Returns the link's overall status, else LinkStatus::Unspecified. |Name|Type|Description| |---|---|---| |netPeerId|integer| |
function GetLinkStatus(netPeerId : Integer) : LinkStatus
GetNetObject : cog
Returns the live net object specified if it is known locally, else nullptr. |Name|Type|Description| |---|---|---| |netObjectId|integer| |
function GetNetObject(netObjectId : Integer) : Cog
GetNetSpace : space
Returns the live net space specified if it is known locally, else nullptr. |Name|Type|Description| |---|---|---| |netObjectId|integer| |
function GetNetSpace(netObjectId : Integer) : Space
GetOurIpAddressFromLink : ipaddress
[Client/Server] Returns our peer's IP address (as seen from their perspective), else IpAddress(). For incoming links this is the same IP address specified in their connect call. (Available if the link is connected or incoming and attempting connection) It is absolutely possible that this does not match our local IP address. |Name|Type|Description| |---|---|---| |netPeerId|integer| |
function GetOurIpAddressFromLink(netPeerId : Integer) : IpAddress
GetUser : cog
Returns the specified network user, else nullptr. |Name|Type|Description| |---|---|---| |netUserId|integer| |
function GetUser(netUserId : Integer) : Cog
GetUsersAddedByPeer : netuserrange
Returns the network users added by the specified peer. |Name|Type|Description| |---|---|---| |netPeerId|integer| |
function GetUsersAddedByPeer(netPeerId : Integer) : NetUserRange
NetPeer : Void
constructor
Constructor. |Name|Type|Description| |---|---|---|
function NetPeer()
Open : boolean
Opens the peer with the specified network role on any available port. Returns true if successful, else false. |Name|Type|Description| |---|---|---| |role|NetRole| |
function Open(role : NetRole) : Boolean
Open : boolean
Opens the peer with the specified network role and port settings. Specify port 0 to indicate any available port should be used. Returns true if successful, else false. |Name|Type|Description| |---|---|---| |role|NetRole| | |port|integer| |
function Open(role : NetRole, port : Integer) : Boolean
Open : boolean
Opens the peer with the specified network role, port, and retry settings. For the given number of retries, if binding is unsuccessful, the port number is incremented and binding is attempted again. Specify port 0 to indicate any available port should be used. Returns true if successful, else false. |Name|Type|Description| |---|---|---| |role|NetRole| | |port|integer| | |retries|integer| |
function Open(role : NetRole, port : Integer, retries : Integer) : Boolean
OpenClient : boolean
Opens the peer as a client on any available port. Returns true if successful, else false. |Name|Type|Description| |---|---|---|
function OpenClient() : Boolean
OpenClient : boolean
Opens the peer as a client with the specified network port. Specify port 0 to indicate any available port should be used. Returns true if successful, else false. |Name|Type|Description| |---|---|---| |port|integer| |
function OpenClient(port : Integer) : Boolean
OpenClient : boolean
Opens the peer as a client with the specified network port and retry settings. For the given number of retries, if binding is unsuccessful, the port number is incremented and binding is attempted again. Specify port 0 to indicate any available port should be used. Returns true if successful, else false. |Name|Type|Description| |---|---|---| |port|integer| | |retries|integer| |
function OpenClient(port : Integer, retries : Integer) : Boolean
OpenOffline : boolean
Opens the peer in offline mode. In offline mode, the peer will act as a pass-through and simulate all applicable network events locally. Always succeeds and returns true. |Name|Type|Description| |---|---|---|
function OpenOffline() : Boolean
OpenServer : boolean
Opens the peer as a server on any available port. Returns true if successful, else false. |Name|Type|Description| |---|---|---|
function OpenServer() : Boolean
OpenServer : boolean
Opens the peer as a server with the specified network port. Specify port 0 to indicate any available port should be used. Returns true if successful, else false. |Name|Type|Description| |---|---|---| |port|integer| |
function OpenServer(port : Integer) : Boolean
RefreshHost : boolean
Refreshes the specified host in the given network's host list. Allowing discovery will enable the host to be discovered if it is not an already known host. Listen to the NetHost event interface to handle the results. Returns true if the host was found and the refresh successfully started, else false (the host could not be found). |Name|Type|Description| |---|---|---| |network|Network| | |ipAddress|ipaddress| | |getExtraHostInfo|boolean| | |allowDiscovery|boolean| | |removeStaleHosts|boolean| |
function RefreshHost(network : Network, ipAddress : IpAddress, getExtraHostInfo : Boolean, allowDiscovery : Boolean, removeStaleHosts : Boolean) : Boolean
RefreshHostList : boolean
Refreshes all hosts in the given network's host list. Allowing discovery will enable new hosts to be discovered in the process of refreshing. Listen to the NetHost event interface to handle the results. Returns true if the refresh was successfully started, else false. |Name|Type|Description| |---|---|---| |network|Network| | |getExtraHostInfo|boolean| | |allowDiscovery|boolean| | |removeStaleHosts|boolean| |
function RefreshHostList(network : Network, getExtraHostInfo : Boolean, allowDiscovery : Boolean, removeStaleHosts : Boolean) : Boolean
RemoveUser : boolean
Name Type Description cog cog function RemoveUser(cog : Cog) : Boolean
RemoveUser : boolean
Name Type Description cog cog requestEvent event function RemoveUser(cog : Cog, requestEvent : Event) : Boolean
RemoveUser : boolean
Name Type Description cog cog requestBundle eventbundle function RemoveUser(cog : Cog, requestBundle : EventBundle) : Boolean
SubscribeToMasterServer : Void
Subscribes to the master server located at the specified IP address. All internet host discovery, record publishing, connection facilitation (NAT punch-through) requests are performed on these master server subscriptions in the order they were subscribed. |Name|Type|Description| |---|---|---| |ipAddress|ipaddress| |
function SubscribeToMasterServer(ipAddress : IpAddress)
UnsubscribeFromMasterServer : Void
Unsubscribes from the master server located at the specified IP address (if subscribed). |Name|Type|Description| |---|---|---| |ipAddress|ipaddress| |
function UnsubscribeFromMasterServer(ipAddress : IpAddress)