AbstractSessionConnect Method (String, Int32, String, String, StrixNetworkConnectEventHandler, StrixNetworkConnectFailedEventHandler, Int32) |
Establishes a connection with a remote server.
Namespace:
SoftGear.Strix.Unity.Runtime.Session
Assembly:
StrixUnityRuntime (in StrixUnityRuntime.dll) Version: 1.5.0
Syntax public void Connect(
string host,
int port,
string protocol,
string authUrl,
StrixNetworkConnectEventHandler connectEventHandler,
StrixNetworkConnectFailedEventHandler errorEventHandler,
int timeout = 20000
)
Parameters
- host
- Type: SystemString
The address of the remote server. Can be either URL, IPv4 address, or IPv6 address. - port
- Type: SystemInt32
The port number of the remote server. Must be between 1 and 65535. - protocol
- Type: SystemString
The protocol used to connect to the remote server. If this parameter is "UDP" (upper case), then UDP protocol is used. Otherwise, TCP is used. - authUrl
- Type: SystemString
Authorization server URL. If not null or empty, and authorization token is provided, used to authorize this client when connecting to the room server. - connectEventHandler
- Type: SoftGear.Strix.Unity.Runtime.EventStrixNetworkConnectEventHandler
This callback is invoked when the connection to the remote server has been established successfully. - errorEventHandler
- Type: SoftGear.Strix.Unity.Runtime.EventStrixNetworkConnectFailedEventHandler
This callback is invoked when the connection could not be established. - timeout (Optional)
- Type: SystemInt32
Timeout for establishing the connection. Currently doesn't work.
Remarks
If the connection with another host is already established, it will be closed before opening a new one.
See Also