Hey Guys. I’ve been making a lot of progress in my quest to understand the OnlineSubsystem, and learning ue4 networking guts. I’ve been stuck on something that should be easy I think. I’m also new to C++ so please forgive my noobishness.
Background: I’ve got an onlineSubsystem working mostly. It’s based on onlineSubsystemNull. Creating sessions works. Searching for sessions works with most of my modified code.
When I run my search for sessions, I’m doing a http request to get a list of non-LAN sessions. This works, but I have been so far unsuccessful with populating the SessionInfo HostAddr. I keep getting “Fatal Error” on execution.
Code snip
FOnlineSession* NewSession = &NewResult->Session;
FString session_host_address = Attributes["session_host_address"]; // from json
FString split_delimiter = ":";
FString IPAddress = TEXT("");
FString Port = TEXT("");
session_host_address.Split(split_delimiter, &IPAddress, &Port );
int32 PortInt = FCString::Atoi(*Port);
TSharedRef<FInternetAddr> internetAddress = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
internetAddress->SetIp(TheIpTChar, isValid);
internetAddress->SetPort(PortInt);
FOnlineSessionInfoLeet* SessionInfo = (FOnlineSessionInfoLeet*)NewSession->SessionInfo.Get();
// Crashes Client
SessionInfo->HostAddr = internetAddress;
Full code reference - LeetClient/OnlineSessionInterfaceLeet.cpp at master · LeetCoinTeam/LeetClient · GitHub
I haven’t been able to find much in terms of examples on how to do this. Any guidance would be appreciated.