How to react to server rejecting client(reading the server error message client side)

My client is connecting to the server by using APlayerController::ClientTravel(TEXT(“IP:PORT”), TRAVEL_Absolute);

On the server, I reject the client in AGameMode::PreLogin() by setting the ErrorMessage.
How can I access this ErrorMessage on the client side to give the info about the rejection reason to the user? How is the client notified that it was rejected (APlayerController::ClientTravel does not return anything and seems to be asynchronous)?

I am also interested in knowing how to access the ErrorMessage on the client-side.

Put the log in a client function, then when the client runs it. It should log it to his log file.

You can bind to the delegate for when Failure messages come through,

GEngine->OnNetworkFailure().AddUObject(this, &UMyGameInstance::NetworkFailureMessage);
void UMyGameInstance::NetworkFailureMessage(UWorld* InWorld, UNetDriver* NetDriver, ENetworkFailure::Type FailureType, const FString& ErrorString)
{
   //Can show failure message here..
}
3 Likes