Language: English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

NetworkTransport.ConnectToNetworkPeer

Switch to Manual
public static function ConnectToNetworkPeer(hostId: int, address: string, port: int, exceptionConnectionId: int, relaySlotId: int, network: Networking.Types.NetworkID, source: Networking.Types.SourceID, node: Networking.Types.NodeID, bytesPerSec: int, bucketSizeFactor: float, out error: byte): int;
public static function ConnectToNetworkPeer(hostId: int, address: string, port: int, exceptionConnectionId: int, relaySlotId: int, network: Networking.Types.NetworkID, source: Networking.Types.SourceID, node: Networking.Types.NodeID, out error: byte): int;

Parameters

hostIdId of udp socket used to establish connection.
addressIP.
portPort.
exceptionConnectionIdId of exception, default in case 0.
relaySlotIdId of remote peer in relay.
networkGuid of relay network.
sourceGuid of user who want to establish connect (serve as tmp password).
errorPossible error.
nodeSlot id reserved for user.
bucketSizeFactorAllowed peak bandwidth (peak bandwidth = factor*bytesPerSec, recommended value is 2.0) If data has not been sent for a long time, it is allowed to send more data, with factor 2 it is allowed send 2*bytesPerSec bytes per sec.
bytesPerSecAverage bandwidth (bandwidth will be throttled on this level).

Returns

int ConnectionId on success (otherwise zero).

Description

Create connection to other peer in the relay group.

Similar to NetworkTransport.Connect but via relay server.