Download

Help on FindSessions always return 0 result.

Dear all,

I’m getting a big headache. I’ve been trying to get network session working for our game for a few days now. However, we can never get IOnlineSubsystem’s FindSessions to return any result.
(Yes we’re following the shooter sample. All configs are configured. All delegates return successfully. We compiled and tested the shooter project and it is working, but not with our project.)

Here’s the code:


HostSettings = MakeShareable(new FOnlineSessionSettings());
	HostSettings->NumPublicConnections = 10;
	HostSettings->NumPrivateConnections = 0;
	HostSettings->bIsLANMatch = true;
	HostSettings->bShouldAdvertise = true;
	HostSettings->bAllowJoinInProgress = true;
	HostSettings->bAllowInvites = true;
	HostSettings->bUsesPresence = true;
	HostSettings->bAllowJoinViaPresence = true;
	HostSettings->bAllowJoinViaPresenceFriendsOnly = false;

	mSession->AddOnCreateSessionCompleteDelegate(OnCreateSessionCompleteDelegate);
	mSession->CreateSession(ControllerId, MapName, *HostSettings);


SearchSettings = MakeShareable(new FOnlineSessionSearch());
	SearchSettings->bIsLanQuery = true;
	SearchSettings->MaxSearchResults = 10;
	SearchSettings->PingBucketSize = 50;
	SearchSettings->QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
	TSharedRef<FOnlineSessionSearch> SearchSettingsRef = SearchSettings.ToSharedRef();

	Sessions->AddOnFindSessionsCompleteDelegate(OnFindSessionsCompleteDelegate);
	Sessions->FindSessions(ControllerId, SearchSettingsRef);

That’s all we have but I don’t get what’s wrong with it and why it doesn’t give out any matching. We have tried turning bIsLANMatch on and off but that didn’t help neither.

Any other pointer for us?

Best.

ps. Also, I can create/join the server with ?listen in the UT shortcut, but not with editor or built project…