Hello,
During testing I found a bug when hosting in 2 standalone games one would host on port 7777 and the other on port 7778.
Which is logical since you can’t have two programs running on the same port.
During testing I joined one for example the one with the address string to port :7777 and I could connect perfectly. Now I pressed my M keybind to open the ingame menu and selected back to main menu, I tried to join the other server hosted on :7778.
This didn’t work and I was put back in the 7777 game even though I selected the other GUID and it had another index in the output log as well.
Next I tried to exit the viewport and run the game in editor again, this doesn’t work for some reason.
However when I run another standalone game from the editor or from right clicking the .uproject I could select the other GUID and it would join on port 7778, but I couldn’t hop back to the 7777 one without closing the standalone game and restarting it.
I also noted the message in the output log: “OSS: Session already exists, can’t join twice”
What I did to fix this was create a function
Header file
UFUNCTION()
void CleanUpSession() override;
Source .cpp file
void UPuzzlePlatformGameInstance::CleanUpSession()
{
OnlineSessionInterface->RemoveNamedSession(SESSIONNAME);
UE_LOG(LogTemp, Warning, TEXT("CleanUpSession"));
}
This function is called when I open the JoinMenu via the RefreshServerList() function in the gameinstance.
This seems to fix the issue, I can now even in editor with play in viewport swap between the two sessions by going back to the main menu and joining the other server. the OSS warning message is also no longer showing up in the output log.
Don’t know if this is something that is handled later on when we maybe disconnect from the session or something? Just wanted to let you know, and if you have any thoughts on this or a better way to do this please let me know