Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

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

NetworkTransport.ConnectAsNetworkHost

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public static function ConnectAsNetworkHost(hostId: int, address: string, port: int, network: Networking.Types.NetworkID, source: Networking.Types.SourceID, node: Networking.Types.NodeID, out error: byte): void;
public static void ConnectAsNetworkHost(int hostId, string address, int port, Networking.Types.NetworkID network, Networking.Types.SourceID source, Networking.Types.NodeID node, out byte error);

Parameters

hostId Id of udp socket used to establish connection.
address Ip4.
port Port.
network Guid of relay network.
source Guid of user.
error Possible error (NetworkError.Ok if success).
node Slot id for this user.

Description

Create dedicated connection to relay server.

Client calls this function to set itself as an owner of the network group on the relay server. This client should call ReceiveRelayEventFromHost periodically to be notified about connection/disconnection events to/from Relay server.