Skip to main content
Version: 5.9.6

JoinGameServer

public bool JoinGameServer(string serverAddress, string serverPort, bool isReconnect, out ErrorInfo errorInfo);

Parameters

ValueTypeDescription
serverAddressstringIn-game server address(server address retrieved from roomInfo of OnMatchMakingResponse)
serverPortushortIn-game server port(server port retrieved from roomInfo of OnMatchMakingResponse)
isReconnectboolReconnection status(false). For more information on how to reconnect, see the documentation on reconnection.
errorInfoErrorInfoSuccess/failure information

For more information on the server address and port required to connect to the in-game server, please refer to the documentation on information for connection to the in-game server.

Description

Attempts to connect to the in-game server.

  • The fact that the in-game server connection method returns true means the server is connected to the socket; it does not mean that the server connection was successful.
  • Actual server connection is established after user authentication is completed in the in-game server, and the success/failure of connection to the in-game server can be checked via the OnSessionJoinInServer event.

Example

string serverAddress;
ushort serverPort;

OnMatchMakingResponse += (args) => // Place to check serverAddress and serverPort
{
string serverAddress = args.RoomInfo.m_inGameServerEndPoint.m_address;
ushort serverPort = args.RoomInfo.m_inGameServerEndPoint.m_port;
}

void JoinInGameServer() // Random method
{
bool isReconnect = true;
ErrorInfo errorInfo = null;

if(Backend.Match.JoinGameServer(serverAddress, serverPort, isReconnect, out errorInfo) == false)
{
// Error confirmation
return;
}
}

Return cases

Success cases When connection between the in-game server and the socket succeeds true errorInfo : ErrorInfo.Success

Error cases When connection to the in-game server fails false errorInfo.Category : ErrorCode.Exception errorInfo.Reason : "reason"

When connection between the in-game server and socket fails false errorInfo.Category : ErrorCode.SocketOperationError errorInfo.SocketError : type of socket error that occurred errorInfo.Reason : "reason"