How to disconnect from listen server?

I open listen server by OpenLevel function like this

// server
UGameplayStatics::OpenLevel(GetWorld(), FName("Chapter01"), true, ((FString)(L"Listen")));

// client
UGameplayStatics::OpenLevel(GetWorld(), FName(*(FString(HostIP.c_str()))));

after game end,
how to disconnect client and server each other and move to other map?
If i use OpenLevel function for EndMatch. unreal say ‘lost host connection’ and crashed.

The normal way would be to call APlayerController::ClientReturnToMainMenuWithTextReason if the Server decides to end the game for the clients.

This will make all disconnect and load the default map.

If the server has a valid GameSession you can also simply call AGameSession::ReturnToMainMenuHost on the server which will do the above on all PlayerControllers

1 Like

I already solve this problem by using openlevel func with netmulticast.
but thx for your reply!!