I’ve got problem with FindSessions in Unreal engine 5.4.4. The session is created correctly see video “CreateSession (first video)”. Unfortunately FindSessions returns me SearchResult empty. When you look at the video “FindSessionIssue (second video)” you can notice that in LANBeacon.cpp line 260 IsValidLanResponsePacket() there goes parameter NumRead (32), in that method there is if statement if (Length > LAN_BEACON_PACKET_HEADER_SIZE) (LAN_BEACON_PACKET_HEADER_SIZE = 32), it returns false and that is the reason why OnValidResponsePacketDelegates.Broadcast() is not called. The delegate is bounded to OnValidResponsePacketReceived() in OnlineSessionInterfaceNull.cpp and it calls SearchResults.Emplace() in line 1205.
When I’m asking for SearchResults I get nothing. Do you know how to solve this header packet problem or how to try different approach of debugging? I’ve also tried to replace my own FindSessions with default unreal BP node FindSessions, but there is same result. I’ve got suspicion that there is also problem with CreateSession, but according to first video everything looks fine.
EDIT:
I’ve found that in Lyra it behaves the same way, except for ListenServer who is running in play editor window it’s says it’s Standalone, in my game it’s says it’s ListenServer in VS debugger.
Also when I’m debugging Lyra there is no sending Packet with length 310 (LANBeacon.cpp line 180 LanBeacon->BroadcastPacket()) as like in mine game, but when Tick() is called in LANBeacon.cpp line 241 LanBeacon->ReceivePacket() it receives packet with length 310 which finds a session and stores it to SearchResults. Unfortunately mine game does not receive a packet with 310 length at all.
I’ve also set LogOnline=VeryVerbose for both games and compare both logs. Logs are the same.
So I’ve made some changes in code. In my game I’ve set some SessionSettings’ variables in order I could call NeedsToAdvertise() in OnlineSessionInterfaceNull.cpp with true as return value.
There is first video of LyraFindSessions to compare with second video of MyGameFindSessions.
First of all in LyraFindSessions and MyGameFIndSessions videos I’m confused why when I’m debugging Tick() in LANBeacon.cpp with UnrealEditor-Engine!GPlayInEditorContextString it shows me “Not in a play world” instead of “Listen Server” or “Client”.
Second of all I do not understand why in LyraFindSessions when I skip Tick() in LANBeacon.cpp it constantly changing LanBeaconState from Hosting to Searching but in the call stack it shows nothing or my debug points are not hit at all when the variable is set. Also I do not get from the packet with length 310 has come, since on the server I’ve just send packet with length 32, nevertheless it works (it finds a session to join) besides that my game, when this weird behaviour is not happing (no changing LanBeaconState variable back and fort and receiving different length packet other than what I’ve actually sent), does not work (it does not find a session to join).