Guys, I read Cedric’s tutorial about GameSession in the UE4 Wiki and I’m trying to solve an issue. My GameInstance has methods to host, find, join and destroy sessions, using IOnlineSubsystem and IOnlineSessionPtr, but, somehow, the connection just timed out and close, everytime, and both clients don’t travel to the PongMap. I can see this in the log. In the code, I’m using FOnlineSessionSettings and FOnlineSessionSearch to configure the session initialization and search, and setting the map I should travel to. Isn’t working.
In the JoinSession I’m doing this:
FString TravelURL;
APlayerController* PlayerController = GetFirstLocalPlayerController();
//Creates the connection information necessary to travel to the server
if (PlayerController && SessionInterface->GetResolvedConnectString(SessionName, TravelURL))
{
GEngine->AddOnScreenDebugMessage(
-1,
10.f,
FColor::Green,
FString::Printf(
TEXT("Travelling to %s"),
*TravelURL
)
);
PlayerController->ClientTravel(TravelURL, ETravelType::TRAVEL_Absolute);
}
And in the HostSession I’m doing this:
UGameplayStatics::OpenLevel(
GetWorld(),
"PongMap",
true,
FString::Printf(
TEXT("listen?%s"),
SessionSettings->bIsLANMatch ?
TEXT("bIsLanMatch=1") : TEXT("bIsLanMatch=0")
)
);
SessionSettings->bIsLANMatch is equal to true, btw.
Here are the images, in these pictures you will see the MainMenuMap, and both clients must travel to the PongMap:
Here are the logs:
Listen server:
[2021.06.23-00.50.20:268][143]LogGameMode: Display: Match State Changed from InProgress to LeavingMap
[2021.06.23-00.50.20:268][143]LogGameState: Match State Changed from InProgress to LeavingMap
[2021.06.23-00.50.20:268][143]LogTemp: Warning: The game state has changed.
[2021.06.23-00.50.20:268][143]LogNet: Browse: /Game/Maps/PongMap?listen?bIsLanMatch=1
[2021.06.23-00.50.20:268][143]LogLoad: LoadMap: /Game/Maps/PongMap?listen?bIsLanMatch=1
[2021.06.23-00.50.20:268][143]LogWorld: BeginTearingDown for /Game/Maps/MainMenuMap
[2021.06.23-00.50.20:268][143]LogSlate: Took 0.000138 seconds to synchronously load lazily loaded font '../../../Engine/Content/Slate/Fonts/Roboto-Regular.ttf' (155K)
[2021.06.23-00.50.20:269][143]LogWorld: UWorld::CleanupWorld for MainMenuMap, bSessionEnded=true, bCleanupResources=true
[2021.06.23-00.50.20:269][143]LogSlate: InvalidateAllWidgets triggered. All widgets were invalidated
[2021.06.23-00.50.20:306][143]LogAudio: Display: Waited 35.997601 ms for audio thread.
[2021.06.23-00.50.20:307][143]LogAudio: Display: Audio Device unregistered from world 'None'.
[2021.06.23-00.50.20:308][143]LogUObjectHash: Compacting FUObjectHashTables data took 0.35ms
[2021.06.23-00.50.20:309][143]LogStreaming: Display: FlushAsyncLoading: 1 QueuedPackages, 0 AsyncPackages
[2021.06.23-00.50.20:316][143]LogAudio: Display: Audio Device (ID: 1) registered with world 'PongMap'.
[2021.06.23-00.50.20:318][143]LogAIModule: Creating AISystem for world PongMap
[2021.06.23-00.50.20:318][143]LogLoad: Game class is 'PongGameMode'
[2021.06.23-00.50.20:318][143]LogNet: ReplicationDriverClass is null! Not using ReplicationDriver.
[2021.06.23-00.50.20:318][143]LogNetCore: DDoS detection status: detection enabled: 0 analytics enabled: 0
[2021.06.23-00.50.20:318][143]LogInit: WinSock: Socket queue. Rx: 131072 (config 131072) Tx: 131072 (config 131072)
[2021.06.23-00.50.20:319][143]LogNet: Created socket for bind address: 0.0.0.0 on port 7777
[2021.06.23-00.50.20:319][143]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2021.06.23-00.50.20:319][143]LogNet: GameNetDriver IpNetDriver_2147482515 IpNetDriver listening on port 7777
[2021.06.23-00.50.20:320][143]LogWorld: Bringing World /Game/Maps/PongMap.PongMap up for play (max tick rate 0) at 2021.06.22-21.50.20
[2021.06.23-00.50.20:320][143]LogWorld: Bringing up level for play took: 0.000582
[2021.06.23-00.50.20:321][143]LogGameMode: Display: Match State Changed from EnteringMap to WaitingToStart
[2021.06.23-00.50.20:321][143]LogGameState: Match State Changed from EnteringMap to WaitingToStart
[2021.06.23-00.50.20:321][143]LogTemp: Warning: The game state has changed.
[2021.06.23-00.50.20:321][143]LogGameMode: Display: Match State Changed from WaitingToStart to InProgress
[2021.06.23-00.50.20:321][143]LogGameState: Match State Changed from WaitingToStart to InProgress
[2021.06.23-00.50.20:321][143]LogTemp: Warning: The game state has changed.
[2021.06.23-00.50.20:322][143]LogLoad: Took 0.054017 seconds to LoadMap(/Game/Maps/PongMap)
[2021.06.23-00.50.31:377][227]LogNet: NotifyAcceptingConnection accepted from: 192.168.0.13:57890
[2021.06.23-00.50.31:377][227]LogHandshake: SendConnectChallenge. Timestamp: 11.121956, Cookie: 077171248231226087187015083198000224073071038057255098212019
[2021.06.23-00.50.31:388][228]LogNet: NotifyAcceptingConnection accepted from: 192.168.0.13:57890
[2021.06.23-00.50.31:388][228]LogHandshake: SendChallengeAck. InCookie: 077171248231226087187015083198000224073071038057255098212019
[2021.06.23-00.50.31:388][228]LogNet: Server accepting post-challenge connection from: 192.168.0.13:57890
[2021.06.23-00.50.31:388][228]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2021.06.23-00.50.31:388][228]LogNet: NotifyAcceptedConnection: Name: PongMap, TimeStamp: 06/22/21 21:50:31, [UNetConnection] RemoteAddr: 192.168.0.13:57890, Name: IpConnection_2147482485, Driver: GameNetDriver IpNetDriver_2147482515, IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID
[2021.06.23-00.50.31:388][228]LogNet: AddClientConnection: Added client connection: [UNetConnection] RemoteAddr: 192.168.0.13:57890, Name: IpConnection_2147482485, Driver: GameNetDriver IpNetDriver_2147482515, IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID
[2021.06.23-00.50.31:395][229]LogNet: NotifyAcceptingChannel Control 0 server World /Game/Maps/PongMap.PongMap: Accepted
[2021.06.23-00.50.31:395][229]LogNet: Remote platform little endian=1
[2021.06.23-00.50.31:395][229]LogNet: This platform little endian=1
[2021.06.23-00.50.31:395][229]LogNetVersion: PongOnline 1.0.0.0, NetCL: 14830424, EngineNetVer: 16, GameNetVer: 0 (Checksum: 368746561)
[2021.06.23-00.50.31:411][230]LogNet: Login request: ?Name=MSI-40AFCCF44C3AB519D30221A3AED2FE72 userId: Null:MSI-40AFCCF44C3AB519D30221A3AED2FE72 platform: Null
[2021.06.23-00.50.31:429][231]LogNet: Client netspeed is 100000
[2021.06.23-00.50.31:463][235]LogNet: Join request: /Game/Maps/MainMenuMap?Name=MSI-40AFCCF44C3AB519D30221A3AED2FE72?SplitscreenCount=1
[2021.06.23-00.50.31:465][235]LogNet: Join succeeded: MSI-40AFCCF44C3AB519
Client:
[2021.06.23-00.50.29:707][722]LogSlate: Took 0.000198 seconds to synchronously load lazily loaded font '../../../Engine/Content/Slate/Fonts/Roboto-Regular.ttf' (155K)
[2021.06.23-00.50.30:364][801]LogGameMode: Display: Match State Changed from InProgress to LeavingMap
[2021.06.23-00.50.30:364][801]LogGameState: Match State Changed from InProgress to LeavingMap
[2021.06.23-00.50.30:365][801]LogTemp: Warning: The game state has changed.
[2021.06.23-00.50.30:365][801]LogNet: Browse: 192.168.0.13/Game/Maps/MainMenuMap
[2021.06.23-00.50.30:365][801]LogInit: WinSock: Socket queue. Rx: 32768 (config 32768) Tx: 32768 (config 32768)
[2021.06.23-00.50.30:365][801]LogNet: Created socket for bind address: 0.0.0.0 on port 0
[2021.06.23-00.50.30:365][801]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2021.06.23-00.50.30:365][801]LogNet: Game client on port 7777, rate 100000
[2021.06.23-00.50.31:381][923]LogHandshake: SendChallengeResponse. Timestamp: 11.121956, Cookie: 077171248231226087187015083198000224073071038057255098212019
[2021.06.23-00.50.31:390][924]LogNetVersion: PongOnline 1.0.0.0, NetCL: 14830424, EngineNetVer: 16, GameNetVer: 0 (Checksum: 368746561)
[2021.06.23-00.50.31:390][924]LogNet: UPendingNetGame::SendInitialJoin: Sending hello. [UNetConnection] RemoteAddr: 192.168.0.13:7777, Name: IpConnection_2147482531, Driver: PendingNetDriver IpNetDriver_2147482532, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
[2021.06.23-00.50.31:418][927]LogNet: Welcomed by server (Level: /Game/Maps/PongMap, Game: /Script/PongOnline.PongGameMode)
[2021.06.23-00.50.31:419][927]LogLoad: LoadMap: 192.168.0.13/Game/Maps/PongMap?game=/Script/PongOnline.PongGameMode
[2021.06.23-00.50.31:419][927]LogWorld: BeginTearingDown for /Game/Maps/MainMenuMap
[2021.06.23-00.50.31:419][927]LogWorld: UWorld::CleanupWorld for MainMenuMap, bSessionEnded=true, bCleanupResources=true
[2021.06.23-00.50.31:419][927]LogSlate: InvalidateAllWidgets triggered. All widgets were invalidated
[2021.06.23-00.50.31:447][927]LogAudio: Display: Audio Device unregistered from world 'None'.
[2021.06.23-00.50.31:448][927]LogUObjectHash: Compacting FUObjectHashTables data took 0.54ms
[2021.06.23-00.50.31:450][927]LogStreaming: Display: FlushAsyncLoading: 1 QueuedPackages, 0 AsyncPackages
[2021.06.23-00.50.31:458][927]LogAudio: Display: Audio Device (ID: 1) registered with world 'PongMap'.
[2021.06.23-00.50.31:461][927]LogWorld: Bringing World /Game/Maps/PongMap.PongMap up for play (max tick rate 0) at 2021.06.22-21.50.31
[2021.06.23-00.50.31:461][927]LogWorld: Bringing up level for play took: 0.000884
[2021.06.23-00.50.31:462][927]LogLoad: Took 0.044222 seconds to LoadMap(/Game/Maps/PongMap)
[2021.06.23-00.50.31:463][927]LogNavigation: Warning: NavData RegistrationFailed_DataPendingKill.
[2021.06.23-00.50.31:538][929]LogTemp: Warning: The game state has changed.
Both the listen server and the client loaded the PongMap, but the map itself doesn’t show in the screen, and it seems that the listen server accepted the Join request from the client. I’m trying to figure out for hours now, without success.
Also, here is my Build.cs:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class PongOnline : ModuleRules
{
public PongOnline(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(
new string[] {
"Core",
"CoreUObject",
"Engine",
"InputCore",
"OnlineSubsystem", //This is necessary to create session through OnlineSubsystems
"OnlineSubsystemUtils", //This is necessary to create session through OnlineSubsystems
"UMG", //This is necessary to create UMGs
"Networking",
"Sockets"
}
);
PrivateDependencyModuleNames.AddRange(
new string[] {
"Slate", //This is necessary to create UMGs
"SlateCore" //This is necessary to create UMGs
}
);
DynamicallyLoadedModuleNames.Add("OnlineSubsystemNull");
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}
Any help will be appreciated!